onClose (XMLSocket.onClose handler)

onClose = function() {}

Invoked only when an open connection is closed by the server. The default implementation of this method performs no actions. To override the default implementation, you must assign a function containing custom actions.

Availability: ActionScript 1.0; Flash Player 5

Example

The following example executes a trace statement if an open connection is closed by the server:

var socket:XMLSocket = new XMLSocket();
socket.connect(null, 2000);
socket.onClose = function () {
    trace("Connection to server lost.");
}

See also

onConnect (XMLSocket.onConnect handler), function statement