700
Understanding Security
■
The SWF files are not in the same domain (for example, one file is at www.domain.com
and one is at store.domain.com).
You must make the following changes:
■
If the called SWF file is published for Flash Player 7 or later, include
System.security.allowDomain
or
LocalConnection.allowDomain
in the called SWF
file, using exact domain-name matching.
■
If the called SWF file is published for Flash Player 6, modify the called file to add or
change a
System.security.allowDomain
or
LocalConnection.allowDomain
statement, using exact domain-name matching, as shown in the code examples earlier in
this section. You can publish the modified file for either Flash Player 6 or 7.
■
If the called SWF file is published for Flash Player 5 or earlier, port the called file to
Flash Player 6 or 7 and add a
System.security.allowDomain
statement, using exact
domain-name matching, as shown in the code examples earlier in this section.
(LocalConnection objects aren’t supported in Flash Player 5 or earlier.)
For information on local security sandboxes, see
“About local file security and Flash Player”
on page 679
.
Allowing data access between cross-domain
SWF files
For two SWF files to access each other’s data (variables and objects), the two files must
originate from the same domain. By default, in Flash Player 7 and later, the two domains
must match exactly for the two files to share data. However, a SWF file can grant access to
SWF files served from specific domains by calling
LocalConnection.allowDomain
or
System.security.allowDomain()
.
System.security.allowDomain()
lets SWF files and HTML files in specified domains
access objects and variables in the SWF file that contains the
allowDomain()
call.
If two SWF files are served from the same domain—for example, http://mysite.com/
movieA.swf and http://mysite.com/movieB.swf—then movieA.swf can examine and modify
variables, objects, properties, methods, and so on in movieB.swf, and movieB can do the same
for movieA. This is called cross-movie scripting, or
cross-scripting
.
If two SWF files are served from different domains—for example, http://mysite.com/
movieA.swf and http://othersite.com/movieB.swf—then, by default, Flash Player does not
allow movieA.swf to script movieB.swf, nor movieB to script movieA. If you call
System.security.allowDomain("mysite.com")
, movieB.swf gives movieA.swf permission
to script movieB.swf. A SWF file gives SWF files from other domains permission to script it
by calling
System.security.allowDomain()
. This is called
cross-domain scripting
.
Содержание FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH
Страница 1: ...Learning ActionScript 2 0 in Flash...
Страница 8: ...8 Contents...
Страница 18: ...18 Introduction...
Страница 30: ...30 What s New in Flash 8 ActionScript...
Страница 66: ...66 Writing and Editing ActionScript 2 0...
Страница 328: ...328 Interfaces...
Страница 350: ...350 Handling Events...
Страница 590: ...590 Creating Interaction with ActionScript...
Страница 710: ...710 Understanding Security...
Страница 730: ...730 Debugging Applications...
Страница 780: ...780 Deprecated Flash 4 operators...
Страница 830: ...830 Index...