reposition a movieclip on stage with coordinates from an xml


hello new forum, , kinda beginner actionscript. i'm trying reposition movieclip coordinates in xml file on server. far no luck.

 

 

this have 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 xml file

 

< position>

 

 

< pos1 xposition="100" yposition="55">

< /pos1>

 

 

< /position>

 

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

use:

 

 

 

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.pos1;

 

my_x = number(mycoord.@xposition);

my_y = number(mycoord.@yposition);

 

}

 

 



More discussions in ActionScript 3


adobe

Comments

Popular posts from this blog

How to change text Component easybook reloaded *newbee* - Joomla! Forum - community, help and support

After Effect warning: A problem occurred when processing OpenGL commands

Preconditions Failed. - Joomla! Forum - community, help and support