
LocalConnection.close() Method
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
594
|
ActionScript Language Reference
LocalConnection.close() Method
stop a connection from receiving messages
Flash 6
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( ).ALocalConnec-
tion 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( )
LocalConnection.connect() Method
open a named connection
Flash 6
receiveConn.connect(connectionName)
Arguments
connectionName ...