Skip to content

Instantly share code, notes, and snippets.

@stickupkid
Created August 15, 2011 18:00
Show Gist options
  • Save stickupkid/1147326 to your computer and use it in GitHub Desktop.
Save stickupkid/1147326 to your computer and use it in GitHub Desktop.
Run HTML in AIR...
import flash.html.HTMLLoader;
var content : String = '<!DOCTYPE html>\
<head>\
<style>\
@-webkit-keyframes pulse {\
0% {\
background-color: red;\
opacity: 1.0;\
-webkit-transform: scale(1.0) rotate(0deg);\
}\
33% {\
background-color: blue;\
opacity: 0.75;\
-webkit-transform: scale(1.5) rotate(-5deg);\
}\
67% {\
background-color: green;\
opacity: 0.5;\
-webkit-transform: scale(1.5) rotate(5deg);\
}\
100% {\
background-color: red;\
opacity: 1.0;\
-webkit-transform: scale(1.0) rotate(0deg);\
}\
}\
body { background:#f0f; }\
button {\
position:absolute;\
background:#fff;\
border:0px;\
-webkit-border-radius:15px;\
width:200px;\
color:#f0f;\
-webkit-animation-name: pulse;\
-webkit-animation-duration: 2s;\
-webkit-animation-iteration-count: 10;\
-webkit-animation-direction: alternate;\
-webkit-animation-timing-function: ease-in-out;\
}\
button:hover {\
background:#ccc;\
}\
</style>\
</head>\
<body>\
<ul>\
<li>Test 1</li>\
<li>Test 2</li>\
</ul>\
<button id="btn" type="checkbox">Button</button>\
</body>\
</html>';
var _DOM : Object;
var $ : Function = function(id : String) : Object
{
return _DOM.getElementById(id);
}
var html : HTMLLoader = new HTMLLoader();
html.addEventListener(Event.COMPLETE, function(event : Event) : void
{
_DOM = html.window.document;
$('btn').onclick = function() : void {
trace('hello');
}
$('btn').onmouseover = function() : void {
trace('over');
}
});
html.loadString(content);
html.width = 400;
html.height = 400;
addChild(html);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment