Server-Side Communication ActionScript > NetConnection.onStatus |
![]() ![]() ![]() |
NetConnection.onStatus
Availability
Flash Communication Server MX.
Usage
myNetConnection
.onStatus = function(infoObject
) { // Your code here };
Parameters
infoObject
An information object. For details about this parameter, see Server-Side Information Objects.
Returns
Nothing.
Description
Event handler; invoked every time the status of the NetConnection object changes. For example, if the connection with the server is lost in an RTMP connection, the NetConnection.isConnected
property is set to false
, and NetConnection.onStatus
is invoked with a status message of NetConnection.Connect.closed
. For AMF connections, NetConnection.onStatus
is used only to indicate a failed connection. Use this event handler to check for connectivity.
Example
This example defines a function for the onStatus
handler that outputs messages to indicate whether the NetConnection was successful:
nc = new NetConnection();
nc.onStatus = function(info){
if (info.code == "NetConnection.Connect.Success") {
_root.gotoAndStop(2);
} else {
if (! nc.isConnected){
_root.gotoAndStop(1);
}
}
};
![]() ![]() ![]() |