03.05.2013 Views

FLASH® LITE™ 2.x - Adobe Help and Support

FLASH® LITE™ 2.x - Adobe Help and Support

FLASH® LITE™ 2.x - Adobe Help and Support

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

socket.onConnect = function (success:Boolean) {<br />

if (success) {<br />

trace ("Connection succeeded!");<br />

} else {<br />

trace ("Connection failed!");<br />

}<br />

}<br />

if (!socket.connect(null, 2000)) {<br />

trace ("Connection failed!");<br />

}<br />

See also<br />

onConnect (XMLSocket.onConnect h<strong>and</strong>ler), Array function, loadPolicyFile<br />

(security.loadPolicyFile method)<br />

onClose (XMLSocket.onClose h<strong>and</strong>ler)<br />

onClose = function() {}<br />

Invoked only when the server closes an open connection. The default implementation of this<br />

method performs no actions. To override the default implementation, you must assign a<br />

function containing custom actions.<br />

Example<br />

The following example executes a trace statement if the server closes an open connection:<br />

var socket:XMLSocket = new XMLSocket();<br />

socket.connect(null, 2000);<br />

socket.onClose = function () {<br />

trace("Connection to server lost.");<br />

}<br />

See also<br />

onConnect (XMLSocket.onConnect h<strong>and</strong>ler), Array function<br />

onConnect (XMLSocket.onConnect h<strong>and</strong>ler)<br />

onConnect = function(success:Boolean) {}<br />

An asynchronous callback that the Flash Lite player invokes when a connection request<br />

initiated through XMLSocket.connect() succeeds or fails. If the connection succeeds, the<br />

success parameter has a value of true; otherwise the success parameter has a value of<br />

false.<br />

718 ActionScript classes

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!