Example
The following example uses
file resides and uses
trace
the connection:
var socket:XMLSocket = new XMLSocket()
socket.onConnect = function (success:Boolean) {
if (success) {
trace ("Connection succeeded!")
} else {
trace ("Connection failed!")
}
}
if (!socket.connect(null, 2000)) {
trace ("Connection failed!")
}
See also
onConnect (XMLSocket.onConnect handler)
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)
XMLSocket.connect()
to display the return value indicating the success or failure of
to connect to the host where the SWF
,
function statement
,
function statement
XMLSocket
1345
Need help?
Do you have a question about the FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE and is the answer not in the manual?