Macromedia flash media server 2-client-side actionscript language reference for flash media server 2 User Manual

Page of 156
74
Client-Side ActionScript Language Reference
The following example opens a connection to play the video2.flv file. Select New Video from 
the Library options menu to create a new Video object, and give it the instance name 
my_video
.
var connection_nc:NetConnection = new NetConnection();
connection_nc.connect(null);
var stream_ns:NetStream = new NetStream(connection_nc);
my_video.attachVideo(stream_ns);
stream_ns.play("video2.flv");
See also
NetConnection.isConnected
Availability
Flash Player 6.
Flash Communication Server MX 1.0.
Usage
my_nc.isConnected
Description
Property (read-only); a Boolean value indicating whether Flash Player is connected to the 
server (
true
) or not (
false
) through the specified connection. Whenever a connection is 
made or closed, this property is set.
Example
The following example is attached to a toggle push button. When the user clicks the button, if 
the user is connected to the server, the connection is closed. If the user is not connected, a 
connection is established.
on (release) {
if (_root.my_nc.isConnected == true)
_root.my_nc.close();
else
_root.my_nc.connect(_root.myURI); 
}
See also