Reputation: 96
Hi i have some movieclips like this one: game_mc.substage_mc.rightHand and inside the rightHand i have a thread_mc like this:
game_mc.substage_mc.rightHand.thread_mc
Ok so here is the thing, i need to access the thread.x and thread.y position related to the stage or substage_mc i don´t really care, but if i do this:
trace(game_mc.substage_mc.rightHand.thread_mc.x);
I only get the thread position related to the rightHand and not to the stage. Any help here?.
Upvotes: 1
Views: 2172
Reputation: 301
Try localToGlobal:
var posX:int = game_mc.substage_mc.rightHand.thread_mc.x;
var posY:int = game_mc.substage_mc.rightHand.thread_mc.y;
trace(game_mc.substage_mc.rightHand.thread_mc.localToGlobal(new Point(posX, posY));
Upvotes: 1
Reputation: 35724
there is a function on the DisplayObject class called localToGlobal
that will give you the coordinates, but you need to keep scale in mind
Upvotes: 2
Reputation: 5740
You have to use the localToGlobal() method.
Here you can find some useful explanation:
Upvotes: 1