Pages

Showing posts with label How to find main parent of child in as3. Show all posts
Showing posts with label How to find main parent of child in as3. Show all posts

Saturday, April 28, 2012

How to get MovieClip X and Y position from child MovieClip to parent main MovieClip in AS3


Step 1: Change Movie clip to Object.
example:- Here have c_mc is child of b_mc and b_mc is a child of a_mc.

now we will find c_mc x and y postion in main stage

var obj:Object=new Object();
obj=a_mc.b_mc.c_mc;

Step 2: Get x and y position using with localToGlobal method.
var poi:Point=new Point(obj.x,obj.y);
poi=obj.parent.localToGlobal(poi);

poi.x and poi.y are c_mc movieclip x,y positions.
Thank you Friends 
...CHeeRS...