User Guide
XMLSocket.connect() 1063
If XMLSocket.connect() returns a value of true, the initial stage of the connection process is
successful; later, the
XMLSocket.onConnect method is invoked to determine whether the final
connection succeeded or failed. If
XMLSocket.connect() returns false, a connection could not
be established.
Example
The following example uses XMLSocket.connect() to connect to the host where the SWF
file resides and uses
trace to display the return value indicating the success or failure of
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
function, XMLSocket.onConnect