EasyManua.ls Logo

MACROMEDIA FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE - Localconnection Constructor

MACROMEDIA FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE
1378 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 725
// determine our domain and see if we need to truncate it
57 var channelDomain:String = lc.domain();
58 if (getVersion() >= 7 && this.getSWFVersion() >= 7)
59 {
// split domain name into elements
60 var domainArray:Array = channelDomain.split(".");
// if more than two elements are found,
// chop off first element to create superdomain
61 if (domainArray.length > 2)
62 {
63 domainArray.shift();
64 channelDomain = domainArray.join(".");
65 }
66 }
67 lc.connect("result");
68 lc.send("mydomain.com:sum", "aSum", channelDomain + ':' + "result",
"aResult", 123, 456);
See also
allowDomain (LocalConnection.allowDomain handler), connect
(LocalConnection.connect method)
LocalConnection constructor
public LocalConnection()
Creates a LocalConnection object.
Availability: ActionScript 1.0; Flash Player 6
Example
The following example shows how receiving and sending SWF files create LocalConnnection
objects. The two SWF files can use the same name or different names for their respective
LocalConnection objects. In this example they use different names.
// Code in the receiving SWF file
this.createTextField("result_txt", 1, 10, 10, 100, 22);
result_txt.border = true;
var receiving_lc:LocalConnection = new LocalConnection();
receiving_lc.methodToExecute = function(param1:Number, param2:Number) {
result_txt.text = param1+param2;
};
receiving_lc.connect("lc_name");
The following SWF file sends the request to the first SWF file.

Table of Contents

Related product manuals