LocalConnection.close( ) Method

ActionScript for Flash MX: The Definitive Guide, 2nd Edition
By Colin Moock
Chapter 18.  ActionScript Language Reference
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( )



    ActionScript for Flash MX. The Definitive Guide
    ActionScript for Flash MX: The Definitive Guide, Second Edition
    ISBN: 059600396X
    EAN: 2147483647
    Year: 2002
    Pages: 780
    Authors: Colin Moock

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net