13.08.2012 Views

ACTIONSCRIPT 3 Developer’s Guide en

ACTIONSCRIPT 3 Developer’s Guide en

ACTIONSCRIPT 3 Developer’s Guide en

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>ACTIONSCRIPT</strong> 3.0 DEVELOPER’S GUIDE<br />

About the HTML <strong>en</strong>vironm<strong>en</strong>t<br />

AIR Run-time Environm<strong>en</strong>t<br />

NativeWindow<br />

HTMLLoader<br />

JavaScript<br />

Environm<strong>en</strong>t<br />

body<br />

h1 div<br />

docum<strong>en</strong>t<br />

p<br />

head<br />

table<br />

window<br />

window<br />

htmlLoader<br />

nativeWindow<br />

runtime<br />

The JavaScript <strong>en</strong>vironm<strong>en</strong>t has its own Docum<strong>en</strong>t and Window objects. JavaScript code can interact with the AIR run-time <strong>en</strong>vironm<strong>en</strong>t<br />

through the runtime, nativeWindow, and htmlLoader properties. ActionScript code can interact with the JavaScript <strong>en</strong>vironm<strong>en</strong>t through the<br />

window property of an HTMLLoader object, which is a refer<strong>en</strong>ce to the JavaScript Window object. In addition, both ActionScript and JavaScript<br />

objects can list<strong>en</strong> for ev<strong>en</strong>ts dispatched by both AIR and JavaScript objects.<br />

The runtime property provides access to AIR API classes, allowing you to create new AIR objects as well as access class<br />

(also called static) members. To access an AIR API, you add the name of the class, with package, to the runtime<br />

property. For example, to create a File object, you would use the statem<strong>en</strong>t:<br />

var file = new window.runtime.filesystem.File();<br />

Note: The AIR SDK provides a JavaScript file, AIRAliases.js, that defines more conv<strong>en</strong>i<strong>en</strong>t aliases for the most<br />

commonly used AIR classes. Wh<strong>en</strong> you import this file, you can use the shorter form air.Class instead of<br />

window.runtime.package.Class. For example, you could create the File object with new air.File().<br />

The NativeWindow object provides properties for controlling the desktop window. From within an HTML page, you<br />

can access the containing NativeWindow object with the window.nativeWindow property.<br />

The HTMLLoader object provides properties, methods, and ev<strong>en</strong>ts for controlling how cont<strong>en</strong>t is loaded and<br />

r<strong>en</strong>dered. From within an HTML page, you can access the par<strong>en</strong>t HTMLLoader object with the window.htmlLoader<br />

property.<br />

Last updated 6/6/2012<br />

961

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!