NetConnection.close( )


NetConnection.close( ) Method Flash 6

closes a connection to the Flash Remoting server
   myNetConnectionObject   .close( ) 

Description

The close( ) method is used to close a connection to the Flash Remoting server. A connection is not a physical connection to the server, so this method does not physically close anything. It merely sets the URL of the NetConnection object to null , thereby causing any further attempts to connect to the server to fail.

Example

The following code shows the basic syntax of the close( ) method:

 if (connected == null) {   connected = true;   NetServices.setDefaultGatewayUrl("http://127.0.0.1/flashservices/gateway");   var my_conn = NetServices.createGatewayConnection( );   var verified = myLoginService( );   if (!verified) my_conn.close( ); } 

In this case, another method named myLoginService( ) is called. If the result of that service call is false , the connection to my_conn is closed at the ActionScript level, thereby nullifying any further attempts to connect to services using the my_conn connection. In practice, the close( ) method is not used very often, as connections need not be closed in most situations.

See Also

NetConnection.connect( ) ; Chapter 4



Flash Remoting
Flash Remoting: The Definitive Guide
ISBN: 059600401X
EAN: 2147483647
Year: 2003
Pages: 239
Authors: Tom Muck

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