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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

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

Security<br />

Master policy files<br />

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

By default, Flash Player (and AIR cont<strong>en</strong>t that is not in the AIR application sandbox) first looks for a URL policy file<br />

named crossdomain.xml in the root directory of the server, and looks for a socket policy file on port 843. A file in<br />

either of these locations is called the master policy file. (In the case of socket connections, Flash Player also looks for a<br />

socket policy file on the same port as the main connection. However, a policy file found on that port is not considered<br />

a master policy file.)<br />

In addition to specifying access permissions, the master policy file can also contain a meta-policy statem<strong>en</strong>t. A metapolicy<br />

specifies which locations can contain policy files. The default meta-policy for URL policy files is “master-only,”<br />

which means that /crossdomain.xml is the only policy file allowed on the server. The default meta-policy for socket<br />

policy files is “all,” which means that any socket on the host can serve a socket policy file.<br />

Note: In Flash Player 9 and earlier, the default meta-policy for URL policy files was “all,” which means that any directory<br />

can contain a policy file. If you have deployed applications that load policy files from locations other than the default<br />

/crossdomain.xml file, and those applications might now be running in Flash Player 10, make sure you (or the server<br />

administrator) modify the master policy file to allow additional policy files. For information on how to specify differ<strong>en</strong>t<br />

a differ<strong>en</strong>t meta-policy, see the Flash Player Developer C<strong>en</strong>ter topic “Policy File Changes in Flash Player 9” at<br />

www.adobe.com/go/devnet_security_<strong>en</strong>.<br />

A SWF file can check for a differ<strong>en</strong>t policy fil<strong>en</strong>ame or a differ<strong>en</strong>t directory location by calling the<br />

Security.loadPolicyFile() method. However, if the master policy file doesn’t specify that the target location can<br />

serve policy files, the call to loadPolicyFile() has no effect, ev<strong>en</strong> if there is a policy file at that location. Call<br />

loadPolicyFile() before attempting any network operations that require the policy file. Flash Player automatically<br />

queues networking requests behind their corresponding policy file attempts. So, for example, it is acceptable to call<br />

Security.loadPolicyFile() immediately before initiating a networking operation.<br />

Wh<strong>en</strong> checking for a master policy file, Flash Player waits three seconds for a server response. If a response isn’t<br />

received, Flash Player assumes that no master policy file exists. However, there is no default timeout value for calls to<br />

loadPolicyFile(); Flash Player assumes that the file being called exists, and waits as long as necessary to load it.<br />

Therefore, if you want to make sure that a master policy file is loaded, use loadPolicyFile() to call it explicitly.<br />

Ev<strong>en</strong> though the method is named Security.loadPolicyFile(), a policy file isn’t loaded until a network call that<br />

requires a policy file is issued. Calls to loadPolicyFile() simply tell Flash Player where to look for policy files wh<strong>en</strong><br />

they are needed.<br />

You can’t receive notification of wh<strong>en</strong> a policy file request is initiated or completed, and there is no reason to do so.<br />

Flash Player performs policy checks asynchronously, and automatically waits to initiate connections until after the<br />

policy file checks have succeeded.<br />

The following sections contain information that applies only to URL policy files. For more information on socket<br />

policy files, see “Connecting to sockets” on page 1057.<br />

URL policy file scope<br />

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

A URL policy file applies only to the directory from which it is loaded and to its child directories. A policy file in the<br />

root directory applies to the whole server; a policy file loaded from an arbitrary subdirectory applies only to that<br />

directory and its subdirectories.<br />

Last updated 6/6/2012<br />

1041

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

Saved successfully!

Ooh no, something went wrong!