Imagine being able to script in HTML5 with whatever language floats your boat... JavaScript, ActionScript, AppleScript... too good to be true?
First off - let me state for the record that this isn't another rant on Flash vs HTML5. Meh.
What this is, is an 'experiment' that explores the notion of an interchangeable / dynamic "Scripting Host" that is set via the HTML <script/> tag. What kind of languages you ask? How about...
* JavaScript
* ActionScript
* AppleScript
* VBScript
* DashScript
* Dart
...to name a few!
What would said web-app look like with ActionScript 3 as the scripting host? Maybe something like this:
<html>
<head>
<title>HTML5: ActionScript 3 Scripting Host</title>
<script type="text/actionscript">
<![CDATA[
// This block is essentially an import.
namespace controls = 'mx.controls';
use namespace controls;
// Anything outside of a function is executed
// as soon as it is loaded.
var b:Button = new Button();
b.label = 'dynamic button';
b.styleName = 'cbutton';
// Example of using closures.
b.addEventListener( 'click', function() {
Console.print('button clicked!');
} );
// Example of named functions.
b.addEventListener( 'mouseOver', onMouseOver );
b.addEventListener( 'mouseOut', onMouseOut );
// Interact with the application body (a canvas).
App.body.addChild( b );
/**
* Handling events just like you would in a compiled app.
*/
function onMouseOver
( e
:Event ):void
{
Console.print( e.currentTarget.label + ' mouse over! ' );
}
function onMouseOut
( e
:Event ):void
{
Console.print( e.currentTarget.label + ' mouse out!' );
}
]]>
</script>
<stylesheet src="sample/application.css"/>
</head>
<body><!-- declarative parsing yet to come! --></body>
</html>
Imagine being able to script in a web application with your language or choice, one that has first-class access to native OS operations (read: faster not necessarily more secure), or mix-and-match as needed. Isn't this where Google is headed with ChromeOS?
Where's the code / sample you say? Links below... knock yourself out.
[ example: AS3 Scripting Host Implementation ]
[ source: AS3 Scripting Host Project ]