Use XMLSocket to retrieve data
package{
import flash.display.Sprite;
import flash.net.*;
import flash.events.*;
public class Main extends Sprite{
var socket:XMLSocket = new XMLSocket();
public function Main(){
socket.addEventListener(Event.CONNECT, connected);
socket.addEventListener(DataEvent.DATA, dataReceived);
socket.connect("localhost", 8989);
}
private function connected(event:Event):void
{
socket.send("hi");
}
private function dataReceived(dataEvent:DataEvent):void
{
trace(dataEvent.data);
var xml:XML = new XML(dataEvent.data);
}
}
}
Related examples in the same category