1 Reply Latest reply on Jul 5, 2009 4:28 PM by kglad

    XML palabre and Flash socket server help......

    javageek1212

      Ok please be patient with me but I'm kinda noobish when it comes to getting information from XML information sent to my flash file from the socket server.......

      OK so for example the server sends me this:

       

      <user ="Javageek">

      <param name="X" value="45.2">

      <param name="Y" value="34">

      </user>

       

      I want to get the name of the user and the X and Y position!

       

      Is there a way I can get this information without a load of fuss from functions and other junk remember im kinda noobish.....

       


      I need help with this really quick so klad and ned please help..... thanks

       

      -Javageek

        • 1. Re: XML palabre and Flash socket server help......
          kglad Adobe Community Professional & MVP

          that's mal-formed xml.  if you use:

           

          <users>
          <user name="Javageek" X="45.2" Y="34"/>
          <user name="Javageek1" X="415.2" Y="314"/>
          </users>

           

           

          you can use the following to parse your xml:

           

          var xml:XML = new XML();
          xml.ignoreWhite = true;

           

          xml.onLoad = function(s){
          for(var i=0;i<this.firstChild.childNodes.length;i++){
          //this.firstChild.childNodes[i].attributes.name;

          //this.firstChild.childNodes[i].attributes.X;

          //this.firstChild.childNodes[i].attributes.Y;
          }
          }
          xml.load("yourxml.xml");