Table of Contents

LocalConnection.send( ) Method Flash 6

invoke a method on a remote LocalConnection object
localConn.send(connectionName, methodName, arg1, arg2,...argn)

Parameters

connectionName

The string name of the connection on which to invoke methodName, as set by the receiver's connect( ) method.

methodName

The string name of the method to invoke on the receiver. Must not be one of the following reserved words: "send", "connect", "close", "domain", "onStatus", or "allowDomain".

arg1, ...argn

Optional arguments to pass to methodName.

Returns

A Boolean�true if the send( ) structure is syntactically correct, otherwise false.

Description

The send( ) method sends a request to invoke the methodName at the connection specified by connectionName. The send( ) method can transfer a maximum of 40 KB of data. The optional arguments passed can be any datatype (Boolean, object, number, etc.). If an object is sent, its class is retained only if it is registered on both sides of the LocalConnection using Object.registerClass( ). See Object.registerClass( ) for more details.

When the sender and receiver movies are both loaded from the same domain, the connectionName for send( ) should simply match the connectionName specified by the receiver's connect( ) method. When the sender and receiver movies are loaded from different domains, the final connection name generated by Flash for the sender must match the final name generated for the receiver.

For the sender, the final connection name is generated as follows:

For the receiver, the final connection name is generated as follows:

On the receiver, the connectionName format "moock.org:channel1" cannot be used (the receiver is not allowed to specify its own subdomain). Table 18-10 shows the specified and final connection name values for both the sender and receiver, and indicates whether each combination would match when the movies are running on the same domain or on different domains. For a full discussion of connection name matching, including overriding the security restrictions across domains, see LocalConnection.allowDomain( ).

Table 18-10. Connection name matching

Sender specified

Sender final

Receiver specified

Receiver final

Same domain match?

Different domain match?

name

senddomain:name

name

recdomain:name

Yes

No (The automatic subdomain prefixes would not match.)

name

senddomain:name

_name

_name

No (No subdomain is used by the receiver.)

No

_name

_name

name

recdomain:name

No (No subdomain is used by the sender.)

No

_name

_name

_name

_name

Yes

Yes (But allowDomain( ) must permit the connection.)

subdomain:name

subdomain:name

name

subdomain:name

Yes, if sender's specified subdomain matches receiver's actual subdomain

Yes (But allowDomain( ) must permit the connection, and sender's specified subdomain must match receiver's actual subdomain.)

subdomain:name

subdomain:name

_name

_name

No (No subdomain is used by the receiver.)

No

See Also

LocalConnection.allowDomain( ), LocalConnection.connect( ), LocalConnection.domain( )


Table of Contents