security (System.security)
573
Example
In the following example, you host a math test on a secure domain so that only registered
students can access it. You have also developed a number of SWF files that illustrate certain
concepts, which you host on an insecure domain. You want students to access the test from
the SWF file that contains information about a concept.
// This SWF file is at https://myEducationSite.somewhere.com/mathTest.swf
// Concept files are at http://myEducationSite.somewhere.com
System.security.allowInsecureDomain("myEducationSite.somewhere.com");
See also
allowDomain (security.allowDomain method)
loadPolicyFile (security.loadPolicyFile method)
public static loadPolicyFile(url:
String
) : Void
Loads a cross-domain policy file from a location specified by the
url
parameter. Flash Player
uses policy files as a permission mechanism to permit Flash movies to load data from servers
other than their own.
Flash Player 7.0.14.0 looked for policy files in only one location: /crossdomain.xml on the
server to which a data-loading request was being made. For an XMLSocket connection
attempt, Flash Player 7.0.14.0 looked for /crossdomain.xml on an HTTP server on port 80 in
the subdomain to which the XMLSocket connection attempt was being made. Flash Player
7.0.14.0 (and all earlier players) also restricted XMLSocket connections to ports 1024 and
later.
With the addition of
System.security.loadPolicyFile()
, Flash Player 7.0.19.0 can load
policy files from arbitrary locations, as shown in the following example:
System.security.loadPolicyFile("http://foo.com/sub/dir/pf.xml");
This causes Flash Player to retrieve a policy file from the specified URL. Any permissions
granted by the policy file at that location will apply to all content at the same level or lower in
the virtual directory hierarchy of the server. The following code continues the previous
example:
loadVariables("http://foo.com/sub/dir/vars.txt") // allowed
loadVariables("http://foo.com/sub/dir/deep/vars2.txt") // allowed
loadVariables("http://foo.com/elsewhere/vars3.txt") // not allowed
Summary of Contents for FLASHLITE2 ACTIONSCRIPT-LANGUAGE
Page 1: ...Flash Lite 2 x ActionScript Language Reference...
Page 22: ...22 Contents...
Page 244: ...244 ActionScript language elements...
Page 760: ...760 ActionScript classes...