03.05.2013 Views

ActionScript 2.0 Language Reference - Adobe Help and Support

ActionScript 2.0 Language Reference - Adobe Help and Support

ActionScript 2.0 Language Reference - Adobe Help and Support

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>Support</strong> has been added for wildcard values with System.security.allowDomain("*")<br />

<strong>and</strong> System.security.allowInsecureDomain("*"). The wildcard (*) value permits<br />

cross-scripting operations where the accessing file is any file at all, loaded from anywhere.<br />

Think of the wildcard as a global permission. Wildcard permissions can be useful in<br />

general, <strong>and</strong> in particular they are required to enable certain kinds of operations under the<br />

new local file security rules in Flash Player 8. Specifically, for a local SWF file with<br />

network-access permissions to script a SWF file on the Internet, the Internet SWF file<br />

being accessed must call System.security.allowDomain("*"), reflecting that the origin<br />

of a local SWF file is unknown. (If the Internet SWF file being accessed is loaded from an<br />

HTTPS URL, the Internet SWF file must instead call<br />

System.security.allowInsecureDomain("*").)<br />

Occasionally, you may encounter the following situation: You load a child SWF file from a<br />

different domain <strong>and</strong> want to allow the child SWF file to script the parent SWF file, but you<br />

don't know the final domain from which the child SWF file will come. This can happen, for<br />

example, when you use load-balancing redirects or third-party servers.<br />

In this situation, you can use the MovieClip._url property as a parameter to this method.<br />

For example, if you load a SWF file into the movie clip my_mc, you can call<br />

System.security.allowDomain(my_mc._url). If you do this, be sure to wait until the<br />

SWF file in my_mc begins loading, because the _url property does not have its final, correct<br />

value until this time. The best way to determine when a child SWF file has begun loading is<br />

to use MovieClipLoader.onLoadStart.<br />

The opposite situation can also occur; that is, you might create a child SWF file that wants to<br />

allow its parent to script it, but doesn't know what the domain of its parent will be. In this<br />

situation, call System.security.allowDomain(_parent._url) from the child SWF. You<br />

don't have to wait for the parent SWF file to load; the parent will already be loaded by the<br />

time the child loads.<br />

If you are publishing for Flash Player 8, you can also h<strong>and</strong>le these situations by calling<br />

System.security.allowDomain("*"). However, this can sometimes be a dangerous<br />

shortcut, because it allows the calling SWF file to be accessed by any other SWF file from any<br />

domain. It is usually safer to use the _url property.<br />

For more information, see the following:<br />

■ The Flash Player 9 Security white paper at http://www.adobe.com/go/fp9_0_security<br />

■ The Flash Player 8 Security-Related API white paper at http://www.adobe.com/go/<br />

fp8_security_apis<br />

Availability: <strong>ActionScript</strong> 1.0; Flash Player 6 - Behavior changed in Flash Player 7; behavior<br />

changed in Flash Player 8.<br />

security (System.security) 1075

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

Saved successfully!

Ooh no, something went wrong!