Coordinates are usually relative to something. X is relative to the parent.
LocalToGlobal and globalToLocal convert coordinate spaces.
You might want to check out transform.pixelBounds and
I do try the localToGlobal but it seems its 1:1 ratio, the codes I use:
// swf is loaded by swfloader, there's a movieclip child named 'child_mc' in it, I want to locate its postion and size. It's top-left coordinates in flash cs4 is 4,740
var swf_obj:MovieClip = MovieClip(swf.content);
var mymc:MovieClip = swf_obj.child_mc;
child_before:Point = new Point(mymc.x, mymc.y);
child_after:Point = swf.localToGlobal(child_before);
the dump result is:
dump screenshot is here: http://img198.imageshack.us/img198/2396/image2ew.png
I use values of child_after to draw green box. The white box is child_mc's actual position after scaled to fit canvas size (in turn the screen size). You can see they are far from each other. Why?
Do you mean I have to multiply the transform matrix myself to get the correct position?
Again, x,y is relative to something. If the SWF is scaled, the child
doesn't know that. The magnifying glass is applied to some parent, not the
I recheck your 2nd last reply & found a way to solve my problem. Many Many thanks!