MACROMEDIA FLEX-FLEX ACTIONSCRIPT LANGUAGE Reference page 441

Actionscript language reference
Table of Contents

Advertisement

// Corresponding commands to allow access by SWF files
// that are running in Flash Player 7 or later
System.security.allowDomain("www.domain.com", "store.domain.com");
Also, for files running in Flash Player 7 or later, you can't use this method to let SWF files hosted
using a secure protocol (HTTPS) allow access from SWF files hosted in nonsecure protocols; you
must use
System.security.allowInsecureDomain()
Occasionally, you might encounter the following situation: You load a child SWF file from a
different domain and want to allow the child SWF file to script the parent SWF file, but you
don't know the final domain from which the child SWF file will come. This can happen, for
example, when you use load-balancing redirects or third-party servers.
In this situation, you can use the
example, if you load a SWF file into
System.security.allowDomain(my_mc._url)
If you do this, be sure to wait until the SWF file in
does not have its final, correct value until the file is completely loaded. The best way to determine
when a child SWF finishes loading is to use
The opposite situation can also occur; that is, you might create a child SWF file that wants to
allow its parent to script it, but doesn't know what the domain of its parent will be. In this
situation, call
System.security.allowDomain(_parent._url)
situation, you don't have to wait for the parent SWF file to load; the parent will already be loaded
by the time the child loads.
Example
The SWF file located at www.macromedia.com/MovieA.swf contains the following lines:
System.security.allowDomain("www.shockwave.com");
loadMovie("http://www.shockwave.com/MovieB.swf", my_mc);
Because MovieA contains the
variables in MovieA. If MovieA didn't contain this command, the Flash security implementation
would prevent MovieB from accessing MovieA's objects and variables.
See also
MovieClip._url, MovieClipLoader.onLoadComplete, _parent,
System.security.allowInsecureDomain()
System.security.allowInsecureDomain()
Availability
Flash Player 7.
Usage
System.security.allowInsecureDomain("domain":String) : Void
Parameters
A string; an exact domain name, such as www.myDomainName.com or
domain
store.myDomainName.com.
property as an argument to this method. For
MovieClip._url
, you can call
my_mc
.
my_mc
MovieClipLoader.onLoadComplete
command, MovieB can access the objects and
allowDomain()
instead.
is loaded, because the
from the child SWF. In this
System.security.allowInsecureDomain()
property
_url
.
441

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLEX-FLEX ACTIONSCRIPT LANGUAGE and is the answer not in the manual?

Subscribe to Our Youtube Channel

This manual is also suitable for:

Flex

Table of Contents