Groups | Blog | Home
all groups > flash actionscript > september 2007 >

flash actionscript : Nested MC X & Y on Root



Donjworks
9/13/2007 9:55:28 PM
Hello,

I have a movie movieclip. There is a nested movie clip inside of that (which
isn't moving in the clip that it's nested in). I want to know the position
(X,Y) of the nested clip. If I tell it to find the position of it with the
script I have, it tells me the X,Y position that it resides in within the
movieclip that its nested in.

Help??

(Did that make any sense?)
Some1Won
9/13/2007 10:13:33 PM
Hi,
clbeech
9/13/2007 10:21:13 PM
use localToGlobal to find the global position of the nested instance. but you
must pass the point with an object reference to make the convertion.


//from the parent timeline
var mcPoint:Object = {x:my_mc._x, y:my_mc._y};
this.localToGlobal(mcPoint);

//now the Object mcPoint x,y properties have been converted
//find the global point by the new object reference:
trace(mcPoint.x+":"+mcPoint.y);
Donjworks
9/13/2007 10:40:38 PM
YAY!! Thanks clbeech, It works!

clbeech
9/13/2007 10:51:41 PM
Hey great Don!! you're welcome.

AddThis Social Bookmark Button