Use XMLSocket to retrieve data : XMLSocket : Network Flash / Flex / ActionScript examples


Flash / Flex / ActionScript examples » Network » XMLSocket »

 

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);
        }
  }
}

        



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


Flash / Flex / ActionScript examples

 Navioo Network
» XMLSocket