User Guide
716 ActionScript classes
case 'status' :
status_ta.text = "LocalConnection connected successfully.";
break;
case 'error' :
status_ta.text = "LocalConnection encountered an error.";
break;
}
};
sending_lc.send("_mylc", "sayHello", name_ti.text);
};
send_button.addEventListener("click", sendListener);
If your SWF file includes a version 2 component, use the version 2 components
DepthManager class instead of the
MovieClip.getNextHighestDepth() method used in the
previous example.
In the following example, the receiving SWF file, which resides in
thisDomain.com, accepts
commands only from SWF files located in
thisDomain.com or thatDomain.com:
var aLocalConn:LocalConnection = new LocalConnection();
aLocalConn.Trace = function(aString) {
aTextField += aString+newline;
};
aLocalConn.allowDomain = function(sendingDomain) {
return (sendingDomain == this.domain() || sendingDomain ==
"www.macromedia.com");
};
aLocalConn.connect("_mylc");
When published for Flash Player 7 or later, exact domain matching is used. This means that
the example will fail if the SWF files are located at www.thatDomain.com but will work if the
files are located at thatDomain.com.
See also
connect (LocalConnection.connect method), domain (LocalConnection.domain
method)
, send (LocalConnection.send method), _url (MovieClip._url property),
onLoadComplete (MovieClipLoader.onLoadComplete event listener), _parent
property