03.05.2013 Views

FLASH® LITE™ 2.x - Adobe Help and Support

FLASH® LITE™ 2.x - Adobe Help and Support

FLASH® LITE™ 2.x - Adobe Help and Support

SHOW MORE
SHOW LESS

Create successful ePaper yourself

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

Occasionally, you might 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 originate. This can happen,<br />

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

In this situation, you can use the MovieClip._url property as an argument to this method. For<br />

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

System.security.allowDomain(my_mc._url).<br />

If you do this, be sure to wait until the SWF file in my_mc is loaded, because the _url<br />

property does not have its final, correct value until the file is completely loaded. The best way<br />

to determine when a child SWF finishes loading is to use MovieClipLoader.onLoadComplete.<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. In this<br />

situation, you don't have to wait for the parent SWF file to load; the parent is already loaded<br />

by the time the child loads.<br />

Parameters<br />

domain1:String - One or more strings that specify domains that can access objects <strong>and</strong><br />

variables in the SWF file that contains the System.Security.allowDomain() call. The<br />

domains can be formatted in the following ways:<br />

■ "domain.com"<br />

■ "http://domain.com"<br />

■ "http://IPaddress"<br />

Example<br />

The SWF file located at www.macromedia.com/MovieA.swf contains the following lines:<br />

System.security.allowDomain("www.shockwave.com");<br />

loadMovie("http://www.shockwave.com/MovieB.swf", my_mc);<br />

Because MovieA contains the allowDomain() call, MovieB can access the objects <strong>and</strong><br />

variables in MovieA. If MovieA didn't contain this call, the Flash security implementation<br />

would prevent MovieB from accessing MovieA's objects <strong>and</strong> variables.<br />

See also<br />

onLoadComplete (MovieClipLoader.onLoadComplete event listener), _parent<br />

(MovieClip._parent property), _url (MovieClip._url property),<br />

allowInsecureDomain (security.allowInsecureDomain method)<br />

security (System.security) 539

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

Saved successfully!

Ooh no, something went wrong!