LocalConnection
723
The most common way to use this command is to include the domain name of the sending
LocalConnection object as a parameter to the method you plan to invoke in the receiving
LocalConnection object or with
LocalConnection.allowDomain
to accept commands from
a specified domain. If you are enabling communication only between LocalConnection
objects that are located in the same domain, you probably don't need to use this command.
Availability:
ActionScript 1.0; Flash Player 6 - Behavior changed in Flash Player 7.
Returns
String
- A string representing the domain of the location of the current SWF file; for more
information, see the Description section.
Example
In the following example, a receiving SWF file accepts commands only from SWF files
located in the same domain or at macromedia.com:
// If both the sending and receiving SWF files are Flash Player 6,
// then use the superdomain
var my_lc:LocalConnection = new LocalConnection();
my_lc.allowDomain = function(sendingDomain):String{
return (sendingDomain==this.domain() || sendingDomain=="macromedia.com");
}
// If either the sending or receiving SWF file is Flash Player 7 or later,
// then use the exact domain. In this case, commands from a SWF file posted
// at www.macromedia.com will be accepted, but those from one posted at
// a different subdomain, e.g. livedocs.macromedia.com, will not.
var my_lc:LocalConnection = new LocalConnection();
my_lc.allowDomain = function(sendingDomain):String{
return (sendingDomain==this.domain() ||
sendingDomain=="www.macromedia.com");
}
In the following example, a sending SWF file located at www.yourdomain.com invokes a
method in a receiving SWF file located at www.mydomain.com. The sending SWF file
includes its domain name as a parameter to the method it invokes, so the receiving SWF file
can return a reply value to a LocalConnection object in the correct domain. The sending
SWF file also specifies that it will accept commands only from SWF files at mydomain.com.
Summary of Contents for FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE
Page 1: ...ActionScript 2 0 Language Reference ...
Page 1352: ...1352 ActionScript classes ...