Flash CS3 Documentation |
|||
| ActionScript 2.0 Language Reference > ActionScript classes > LocalConnection > send (LocalConnection.send method) | |||
Invokes the method named method on a connection opened with the LocalConnection.connect(connectionName) command (the receiving LocalConnection object). The object used with this command is called the sending LocalConnection object. The SWF files that contain the sending and receiving objects must be running on the same client computer.
There is a 40 kilobyte limit to the amount of data you can pass as parameters to this command. If the command returns false but your syntax is correct, try dividing the LocalConnection.send() requests into multiple commands, each with less than 40K of data.
As discussed in the entry LocalConnection.connect(), Flash adds the current superdomain to connectionName by default. If you are implementing communication between different domains, you need to define connectionName in both the sending and receiving LocalConnection objects in such a way that Flash does not add the current superdomain to connectionName. You can do this in one of the following two ways:
connectionName in both the sending and receiving LocalConnection objects. In the SWF file containing the receiving object, use LocalConnection.allowDomain to specify that connections from any domain will be accepted. This implementation lets you store your sending and receiving SWF files in any domain.connectionName in the sending LocalConnection object--for example, myDomain.com:myConnectionName. In the receiving object, use LocalConnection.allowDomain to specify that connections from the specified superdomain will be accepted (in this case, myDomain.com) or that connections from any domain will be accepted.Note: You cannot specify a superdomain in connectionName in the receiving LocalConnection object--you can only do this in the sending LocalConnection object.
When using this method, consider the Flash Player security model. By default, a LocalConnection object is associated with the sandbox of the SWF file that created it, and cross-domain calls to LocalConnection objects are not allowed unless the LocalConnection.allowDomain() method has been invoked.
For more information, see the following:
Availability: ActionScript 1.0; Flash Player 6
connectionName:String - A string that corresponds to the connection name specified in the LocalConnection.connect() command that wants to communicate with sending_lc.
methodName:String - A string specifying the name of the method to be invoked in the receiving LocalConnection object. The following method names cause the command to fail: send, connect, close, domain, onStatus, and allowDomain.
args:Object [optional] - Arguments to be passed to the specified method.
Boolean - A Boolean value: true if Flash can carry out the request; false otherwise.
Note: A return value of true does not necessarily mean that Flash successfully connected to a receiving LocalConnection object; it means only that the command is syntactically correct. To determine whether the connection succeeded, see LocalConnection.onStatus.
For an example of communicating between LocalConnection objects located in the same domain, see LocalConnection.connect(). For an example of communicating between LocalConnection objects located in any domain, see LocalConnection.allowDomain. For an example of communicating between LocalConnection objects located in specified domains, see LocalConnection.allowDomain and LocalConnection.domain().
allowDomain (LocalConnection.allowDomain handler), connect (LocalConnection.connect method), domain (LocalConnection.domain method), onStatus (LocalConnection.onStatus handler)
Flash CS3
Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/flash/9.0/main/00001800.html