18 Replies Latest reply: Aug 5, 2012 4:41 AM by Ned Murphy RSS

    reposition a movieclip on stage with coordinates from an xml

    4morrone Community Member

      Hello i am new to this forum, and kinda a beginner with actionscript. what i'm trying to do is reposition a movieclip already with the coordinates that will be in an XML file on my server. But so far no luck.

       

       

      This is what i have for AS3

       

      var my_x:Number;

      var my_y:Number;

      var myCoord:XML;

       

      sample_mc.x = my_x;

      sample_mc.y = my_y;

       

      var myXMLLoader:URLLoader = new URLLoader();

      myXMLLoader.load(new URLRequest("coords.xml"));

      myXMLLoader.addEventListener(Event.COMPLETE, processXML);

       

       

      function processXML (e:Event):void{

      var myXML:XML = new XML(e.target.data);

      myCoord = myXML.position.pos1;

       

      my_x = myCoord.@XPOSITION;

      my_y = myCoord.@YPOSITION;

       

      }

       

       

      And the XML file

       

      < position>

       

       

      < pos1 XPOSITION="100" YPOSITION="55">

      < /pos1>

       

       

      < /position>

       

      let me know if anyone can correct what i'm doing wrong, please.