Macromedia flash media server 2-client-side actionscript language reference for flash media server 2 ユーザーズマニュアル

ページ / 156
68
Client-Side ActionScript Language Reference
Description
Method; closes the connection with the server and invokes 
NetConnection.onStatus
 with a 
code
 property of 
NetConnection.Connect.Close
. For more information, see 
This method disconnects all NetStream objects running over this connection; any queued 
data that has not been sent is discarded. (To terminate server streams without closing the 
connection, use 
.) If you want to reconnect, you must recreate the 
NetStream object (see 
).
This method also disconnects all remote shared objects running over this connection. 
However, you don’t need to recreate the shared object to reconnect. Instead, you can just call 
 to reestablish the connection to the shared object. Also, any data 
in the shared object that was queued when you issued 
NetConnection.close()
 will be sent 
after you reestablish a connection to the shared object.
Example
The following 
disconnect()
 function stops the published stream, then calls 
NetConnection.close()
 to delete the source connection. With no source stream to play, the 
destination stream automatically ends and is deleted.
function disconnect() {
// stops publishing the stream
srcStream_ns.close();
// deletes the source stream connection 
my_nc.close();
}
See also
NetConnection.connect()
Availability
Flash Player 6.
Flash Communication Server MX 1.0.
Usage
public connect(targetURI:String) : Boolean