Question

I have a movieclip inside another movieclip...

//create on the stage an empty movieclip... 
var mc_container:MovieClip = _root.createEmptyMovieClip("container_name", _root.getNextHighestDepth());

//new position on the stage...
mc_container._x = 200;
mc_container._y = 200;

//create a movieclip inside the main movieclip...
var mc_inside:MovieClip = mc_container.attachMovie("mc_from_library", "mc_name", mc_container.getNextHighestDepth(), {_x:0, _y:0, _alpha:100});

I can get mc_inside._x and mc_inside._y properties relative to the container movieclip, but how can I get the mc_inside._x and mc_inside._y relative to the _root (the stage)?

Was it helpful?

Solution

Use localToGlobal:

var point:Object = {x:myClip.inner_mc._x, y:myClip.inner_mc._y};
myClip.inner_mc.localToGlobal(point);
trace(point.x)
trace(point.y)

http://help.adobe.com/en_US/as2/reference/flashlite/WS5b3ccc516d4fbf351e63e3d118ccf9c47f-7d06.html

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top