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()
method in the receiving SWF file. For a discussion of the use of the underscore (_) in the
Trace
connection name, see
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.allowInsecureDomain
Availability
Flash Player 7.
Usage
receiving_lc.allowInsecureDomain = function([sendingDomain]) {
// Your statements here return true or false
}
Parameters
sendingDomain
sending LocalConnection object.
Returns
Nothing.
, in which only SWF files from the same domain can invoke the
LocalConnection.send()
,
LocalConnection.domain()
An optional parameter specifying the domain of the SWF file containing the
.
,
LocalConnection.send()
LocalConnection.allowInsecureDomain
437
Need help?
Do you have a question about the FLASH MX 2004 - ACTIONSCRIPT and is the answer not in the manual?