Table of Contents

LocalConnection.close( ) Method Flash 6

stop a connection from receiving messages
receiveConn.close()

Returns

A Boolean�true if an open connection was closed, false if no open connection was found for receiveConn.

Description

The close( ) method is used only by a receiving LocalConnection object to close an open connection, thus preventing future senders from invoking its methods. For example, the following code opens a connection named "channel2", making displayMsg( ) eligible for remote execution:

receiveConn = new LocalConnection();
receiveConn.displayMsg = function (msg) {
  output_txt.text += msg + "\n";
}
receiveConn.connect("channel2");

Later, we can close the "channel2" connection by invoking close( ):

receiveConn.close();

Closing the connection prevents all senders from invoking displayMsg( ). A LocalConnection object can maintain only one open connection at a time. Hence, close( ) does not take the name of a connection to close as a parameter. Note that close( ) applies only to receivers; a LocalConnection object that only sends messages need not open or close a connection.

See Also

LocalConnection.connect( )


Table of Contents