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

The frame dispatches the dominitialize ev<strong>en</strong>t early <strong>en</strong>ough in the loading sequ<strong>en</strong>ce that any script in the child page<br />

can refer<strong>en</strong>ce objects, variables, and functions added to the child docum<strong>en</strong>t by the dominitialize handler. The<br />

par<strong>en</strong>t page must be in the same sandbox as the child to directly add or access any objects in a child docum<strong>en</strong>t.<br />

However, a par<strong>en</strong>t in the application sandbox can establish a sandbox bridge to communicate with cont<strong>en</strong>t in a nonapplication<br />

sandbox.<br />

The following examples illustrate use of the iframe tag in AIR:<br />

Place child.html in a remote sandbox, without mapping to an actual domain on a remote server:<br />

<br />

Place child.html in a remote sandbox, allowing XMLHttpRequests only to www.example.com:<br />

<br />

Place child.html in a remote sandbox, allowing XMLHttpRequests to any remote domain:<br />

<br />

Place child.html in a local-with-file-system sandbox:<br />

<br />

Place child.html in a remote sandbox, using the dominitialize ev<strong>en</strong>t to establish a sandbox bridge:<br />

<br />

<br />

<br />

var bridgeInterface = {};<br />

bridgeInterface.testProperty = "Bridge <strong>en</strong>gaged";<br />

function <strong>en</strong>gageBridge(){<br />

docum<strong>en</strong>t.getElem<strong>en</strong>tById("sandbox").par<strong>en</strong>tSandboxBridge = bridgeInterface;<br />

}<br />

<br />

<br />

<br />

<br />

<br />

<br />

The following child.html docum<strong>en</strong>t illustrates how child cont<strong>en</strong>t can access the par<strong>en</strong>t sandbox bridge:<br />

Last updated 6/6/2012<br />

971

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

Saved successfully!

Ooh no, something went wrong!