Name: Anonymous 2010-10-07 6:57
Ok i got this code, but it will only sends the message "MESSAGE HERE" after the connection is closed.
var xml_s=new XMLSocket();
xml_s.connect("localhost", 2004);
xml_s.addEventListener(Event.CONNECT,xmlsocket);//OnConnect//
xml_s.addEventListener(Event.CLOSE,xmlsocket);//OnDisconnect//
xml_s.addEventListener(IOErrorEvent.IO_ERROR,xmlsocket);//Unable To Connect//
function xmlsocket(Event):void{
switch(Event.type){
case 'ioError':
cout.text="error";
break;
case 'connect':
cout.text="connected";
break;
case 'close':
cout.text="disconnect";
break;
}
}
xml_s.send("MESSAGE HERE");
var xml_s=new XMLSocket();
xml_s.connect("localhost", 2004);
xml_s.addEventListener(Event.CONNECT,xmlsocket);//OnConnect//
xml_s.addEventListener(Event.CLOSE,xmlsocket);//OnDisconnect//
xml_s.addEventListener(IOErrorEvent.IO_ERROR,xmlsocket);//Unable To Connect//
function xmlsocket(Event):void{
switch(Event.type){
case 'ioError':
cout.text="error";
break;
case 'connect':
cout.text="connected";
break;
case 'close':
cout.text="disconnect";
break;
}
}
xml_s.send("MESSAGE HERE");