Server-Side Communication ActionScript > NetConnection.isConnected

 

NetConnection.isConnected

Availability

Flash Communication Server MX.

Usage

myNetConnection.isConnected

Description

Property (read-only); a Boolean value that indicates whether a connection has been made. It is set to true if there is a connection to the server. It's a good idea to check this property value in the onStatus callback function. This property is always true for AMF connections to application servers.

Example

This example uses NetConnection.isConnected inside an onStatus definition to check if a connection has been made:

nc = new NetConnection();
nc.connect("rtmp://tc.foo.com/myApp");
nc.onStatus = function(infoObj){
	if (info.code == "NetConnection.Connect.Success" && nc.isConnected){
		trace("We are connected");
	}
};