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 and WebKit<br />

Adobe AIR 1.0 and later<br />

Adobe AIR uses the op<strong>en</strong> source WebKit <strong>en</strong>gine, also used in the Safari web browser. AIR adds several ext<strong>en</strong>sions to<br />

allow access to the runtime classes and objects as well as for security. In addition, WebKit itself adds features not<br />

included in the W3C standards for HTML, CSS, and JavaScript.<br />

Only the AIR additions and the most noteworthy WebKit ext<strong>en</strong>sions are covered here; for additional docum<strong>en</strong>tation<br />

on non-standard HTML, CSS, and JavaScript, see www.webkit.org and developer.apple.com. For standards<br />

information, see the W3C web site. Mozilla also provides a valuable g<strong>en</strong>eral refer<strong>en</strong>ceon HTML, CSS, and DOM topics<br />

(of course, the WebKit and Mozilla <strong>en</strong>gines are not id<strong>en</strong>tical).<br />

JavaScript in AIR<br />

Flash Player 9 and later, Adobe AIR 1.0 and later<br />

AIR makes several changes to the typical behavior of common JavaScript objects. Many of these changes are made to<br />

make it easier to write secure applications in AIR. At the same time, these differ<strong>en</strong>ces in behavior mean that some<br />

common JavaScript coding patterns, and existing web applications using those patterns, might not always execute as<br />

expected in AIR. For information on correcting these types of issues, see “Avoiding security-related JavaScript errors”<br />

on page 980.<br />

HTML Sandboxes<br />

Adobe AIR 1.0 and later<br />

AIR places cont<strong>en</strong>t into isolated sandboxes according to the origin of the cont<strong>en</strong>t. The sandbox rules are consist<strong>en</strong>t<br />

with the same-origin policy implem<strong>en</strong>ted by most web browsers, as well as the rules for sandboxes implem<strong>en</strong>ted by<br />

the Adobe Flash Player. In addition, AIR provides a new application sandbox type to contain and protect application<br />

cont<strong>en</strong>t. See “Security sandboxes” on page 1033 for more information on the types of sandboxes you may <strong>en</strong>counter<br />

wh<strong>en</strong> developing AIR applications.<br />

Access to the run-time <strong>en</strong>vironm<strong>en</strong>t and AIR APIs are only available to HTML and JavaScript running within the<br />

application sandbox. At the same time, however, dynamic evaluation and execution of JavaScript, in its various forms,<br />

is largely restricted within the application sandbox for security reasons. These restrictions are in place whether or not<br />

your application actually loads information directly from a server. (Ev<strong>en</strong> file cont<strong>en</strong>t, pasted strings, and direct user<br />

input may be untrustworthy.)<br />

The origin of the cont<strong>en</strong>t in a page determines the sandbox to which it is consigned. Only cont<strong>en</strong>t loaded from the<br />

application directory (the installation directory refer<strong>en</strong>ced by the app: URL scheme) is placed in the application<br />

sandbox. Cont<strong>en</strong>t loaded from the file system is placed in the local-with-file system or the local-trusted sandbox, which<br />

allows access and interaction with cont<strong>en</strong>t on the local file system, but not remote cont<strong>en</strong>t. Cont<strong>en</strong>t loaded from the<br />

network is placed in a remote sandbox corresponding to its domain of origin.<br />

To allow an application page to interact freely with cont<strong>en</strong>t in a remote sandbox, the page can be mapped to the same<br />

domain as the remote cont<strong>en</strong>t. For example, if you write an application that displays map data from an Internet service,<br />

the page of your application that loads and displays cont<strong>en</strong>t from the service could be mapped to the service domain.<br />

The attributes for mapping pages into a remote sandbox and domain are new attributes added to the frame and iframe<br />

HTML elem<strong>en</strong>ts.<br />

Last updated 6/6/2012<br />

963

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

Saved successfully!

Ooh no, something went wrong!