
Client-Side Communication ActionScript 35
• The aResult method (line 54) displays the value returned by aSum (579).
// The receiving movie at http://www.mydomain.com/folder/movie.swf
// contains the following code
1 var aLocalConnection = new LocalConnection();
2 aLocalConnection.allowDomain = function()
3 {
// allow connections from any domain
4 return true;
5 }
6 aLocalConnection.aSum = function(sender, replyMethod, n1, n2)
7{
8 this.send(sender, replyMethod, (n1 + n2));
9}
10
11 aLocalConnection.connect("sum");
// The sending movie at http://www.yourdomain.com/folder/movie.swf
// contains the following code
50 var lc = new LocalConnection();
51 lc.allowDomain = function(aDomain) {
// allow connections only from mydomain.com
52 return (aDomain == "mydomain.com");
53 }
54 lc.aResult = function(aParam) {
55 trace("The sum is " + aParam);
56 }
57
58 lc.connect("result");
59 lc.send("mydomain.com:sum", "aSum", lc.domain() + ’:’ + "result",
"aResult", 123, 456);
See also
LocalConnection.allowDomain
LocalConnection.onStatus
Availability
• Flash Player 6.
• Flash Communication Server MX (not required).
Usage
sendingLC.onStatus = function(infoObject) {
// Your code here
}
Parameters
infoObject A parameter defined according to the status message. For details about this
parameter, see the description below.
Returns
Nothing.
Kommentare zu diesen Handbüchern