EasyManua.ls Logo

MACROMEDIA FLASH MX 2004 - ACTIONSCRIPT - Page 437

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...
LocalConnection.allowInsecureDomain 437
Example
The following example shows how a LocalConnection object in a receiving SWF file can permit
SWF files from any domain to invoke its methods. Compare this to the example in
LocalConnection.connect(), in which only SWF files from the same domain can invoke the
Trace method in the receiving SWF file. For a discussion of the use of the underscore (_) in the
connection name, see
LocalConnection.send().
var aLocalConnection = new LocalConnection();
aLocalConnection.Trace = function(aString)
{
aTextField = aTextField + aString + newline;
}
aLocalConnection.allowDomain = function() {
// Any domain can invoke methods on this LocalConnection object
return true;
}
aLocalConnection.connect("_trace");
In the following example, the receiving SWF file accepts commands only from SWF files located
in thisDomain.com or thatDomain.com.
var aLocalConnection = new LocalConnection();
aLocalConnection.Trace = function(aString)
{
aTextField = aTextField + aString + newline;
}
aLocalConnection.allowDomain = function(sendingDomain)
{
return(sendingDomain=="thisDomain.com" || sendingDomain=="thatDomain.com");
}
aLocalConnection.connect("_trace");
See also
LocalConnection.connect()
, LocalConnection.domain(), LocalConnection.send()
LocalConnection.allowInsecureDomain
Availability
Flash Player 7.
Usage
receiving_lc.allowInsecureDomain = 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.

Table of Contents

Related product manuals