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 />

Programming HTML and JavaScript in AIR<br />

To use the AIRAliases.js file, include the following script refer<strong>en</strong>ce in your HTML page:<br />

<br />

Adjust the path in the src refer<strong>en</strong>ce, as needed.<br />

Important: Except where noted, the JavaScript example code in this docum<strong>en</strong>tation assumes that you have included<br />

the AIRAliases.js file in your HTML page.<br />

About URLs in AIR<br />

Adobe AIR 1.0 and later<br />

In HTML cont<strong>en</strong>t running in AIR, you can use any of the following URL schemes in defining src attributes for img,<br />

frame, iframe, and script tags, in the href attribute of a link tag, or anywhere else you can provide a URL.<br />

URL scheme Description Example<br />

file A path relative to the root of the file system. file:///c:/AIR Test/test.txt<br />

app A path relative to the root directory of the installed<br />

application.<br />

app-storage A path relative to the application store directory. For each<br />

installed application, AIR defines a unique application store<br />

directory, which is a useful place to store data specific to that<br />

application.<br />

For more information about using URL schemes in AIR, see “URI schemes” on page 812.<br />

Many of AIR APIs, including the File, Loader, URLStream, and Sound classes, use a URLRequest object rather than a<br />

string containing the URL. The URLRequest object itself is initialized with a string, which can use any of the same url<br />

schemes. For example, the following statem<strong>en</strong>t creates a URLRequest object that can be used to request the Adobe<br />

home page:<br />

var urlReq = new air.URLRequest("http://www.adobe.com/");<br />

For information about URLRequest objects see “HTTP communications” on page 810.<br />

Making ActionScript objects available to JavaScript<br />

Adobe AIR 1.0 and later<br />

JavaScript in the HTML page loaded by an HTMLLoader object can call the classes, objects, and functions defined in<br />

the ActionScript execution context using the window.runtime, window.htmlLoader, and window.nativeWindow<br />

properties of the HTML page. You can also make ActionScript objects and functions available to JavaScript code by<br />

creating refer<strong>en</strong>ces to them within the JavaScript execution context.<br />

Last updated 6/6/2012<br />

app:/images<br />

app-storage:/settings/prefs.xml<br />

http A standard HTTP request. http://www.adobe.com<br />

https A standard HTTPS request. https://secure.example.com<br />

986

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

Saved successfully!

Ooh no, something went wrong!