EasyManua.ls Logo

MACROMEDIA FLASH MX 2004 - ACTIONSCRIPT - Page 436

MACROMEDIA FLASH MX 2004 - ACTIONSCRIPT
816 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
436 Chapter 12: ActionScript Dictionary
LocalConnection.allowDomain
Availability
Flash Player 6; behavior changed in Flash Player 7.
Usage
receiving_lc.allowDomain = function([sendingDomain]) {
// Your statements here return true or false
}
Parameters
sendingDomain
An optional parameter specifying the domain of the SWF file containing the
sending LocalConnection object.
Returns
Nothing.
Description
Event handler; invoked whenever receiving_lc receives a request to invoke a method from a
sending LocalConnection object. Flash expects the code you implement in this handler to return
a Boolean value of
true or false. If the handler doesnt return true, the request from the
sending object is ignored, and the method is not invoked.
Use this command to explicitly permit LocalConnection objects from specified domains, or from
any domain, to execute methods of the receiving LocalConnection object. If you dont declare the
sendingDomain parameter, you probably want to accept commands from any domain, and the
code in your handler would be simply
return true. If you do declare sendingDomain, you
probably want to compare the value of
sendingDomain with domains from which you want to
accept commands. The following examples illustrate both of these implementations.
In files running in Flash Player 6, the
sendingDomain parameter contains the superdomain of the
caller. In files running in Flash Player 7 or later, the
sendingDomain parameter contains the exact
domain of the caller. In the latter case, to allow access by SWF files hosted at either
www.domain.com or store.domain.com, you must explicitly allow access from both domains.
// For Flash Player 6
receiving_lc.allowDomain = function(sendingDomain) {
return(sendingDomain=="domain.com");
}
// Corresponding commands to allow access by SWF files
// that are running in Flash Player 7 or later
receiving_lc.allowDomain = function(sendingDomain) {
return(sendingDomain=="www.domain.com" ||
sendingDomain=="store.domain.com");
}
Also, for files running in Flash Player 7 or later, you cant use this method to allow SWF files
hosted using a secure protocol (HTTPS) to permit access from SWF files hosted in nonsecure
protocols; you must use the LocalConnection.allowInsecureDomain event handler instead.

Table of Contents

Related product manuals