Listen to the connect event
package {
import flash.display.Sprite;
import flash.events.*;
import flash.net.XMLSocket;
public class SocketExample extends Sprite {
private var socket:XMLSocket;
public function SocketExample( ) {
socket = new XMLSocket( );
socket.addEventListener( Event.CONNECT, onConnect );
socket.connect( "localhost", 2900 );
}
private function onConnect( event:Event ):void {
trace( "The xml socket is now connected..." );
}
}
}
Security.loadPolicyFile("http://www.java2s.com/crossdomain.xml");
Related examples in the same category