![]() ![]() ![]() | |
![]() | |
![]() | |
![]() |
When you develop a series of SWF files that communicate with each otherfor example, when using loadMovie()
, MovieClip.loadMovie()
, MovieClipLoader.LoadClip()
, or Local Connection objectsyou might host the movies in different domains, or in different subdomains of a single superdomain.
In files published for Flash Player 5 or earlier, there were no restrictions on cross-domain or subdomain access.
In files published for Flash Player 6, you could use the LocalConnection.allowDomain
handler or System.security.allowDomain()
method to specify permitted cross-domain access (for example, to let a file at someSite.com be accessed by a file at someOtherSite.com), and no command was needed to permit subdomain access (for example, a file at www.someSite.com could be accessed by a file at store.someSite.com).
Files published for Flash Player 7 implement access between SWF files differently from earlier versions in two ways. First, Flash Player 7 implements exact-domain matching rules instead of superdomain matching rules. Therefore, the file being accessed (even if it is published for a Player version earlier than Flash Player 7) must explicitly permit cross-domain or subdomain access; this topic is discussed below. Second, a file hosted at a site using a secure protocol (HTTPS) must explicitly permit access from a file hosted at a site using an insecure protocol (HTTP or FTP); this topic is discussed in the next section (see HTTP to HTTPS protocol access between SWF files).
Because Flash Player 7 implements exact-domain matching rules instead of superdomain matching rules, you might have to modify existing scripts if you want to access them from files that are published for Flash Player 7. (You can still publish the modified files for Flash Player 6.) If you used any LocalConnection.allowDomain()
or System.security.allowDomain()
statements in your files and specified superdomain sites to permit, you must change your parameters to specify exact domains instead. The following code shows an example of the kinds of changes you might have to make:
// Flash Player 6 commands in a SWF file at www.anyOldSite.com // to allow access by SWF files that are hosted at www.someSite.com // or at store.someSite.com System.security.allowDomain("someSite.com"); my_lc.allowDomain = function(sendingDomain) { return(sendingDomain=="someSite.com"); } // Corresponding commands to allow access by SWF files // that are published for Flash Player 7 System.security.allowDomain("www.someSite.com", "store.someSite.com"); my_lc.allowDomain = function(sendingDomain) { return(sendingDomain=="www.someSite.com" || sendingDomain=="store.someSite.com"); }
You might also have to add statements like these to your files if you aren't currently using them. For example, if your SWF file is hosted at www.someSite.com and you want to allow access by a SWF file published for Flash Player 7 at store.someSite.com, you must add statements like the following to the file at www.someSite.com (you can still publish the file at www.someSite.com for Flash Player 6):
System.security.allowDomain("store.someSite.com"); my_lc.allowDomain = function(sendingDomain) { return(sendingDomain=="store.someSite.com"); }
To summarize, you might have to modify your files to add or change allowDomain
statements if you publish files for Flash Player 7 that meet the following conditions:
loadMovie()
, MovieClip.loadMovie()
, MovieClipLoader.LoadClip()
, or Local Connection objects).You have to make the following changes:
System.security.allowDomain
or LocalConnection.allowDomain
in the called SWF file, using exact domain-name matching.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.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.)![]() | |
![]() | |
![]() | |
![]() ![]() ![]() |