Quantcast
Channel: Adobe Community : Discussion List - All Communities
Viewing all articles
Browse latest Browse all 238792

reposition a movieclip on stage with coordinates from an xml

$
0
0

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.


Viewing all articles
Browse latest Browse all 238792

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>