0
votes

I'm trying to get the global point (x,y) of an object. This object is a child of a rotated parent, MovieClip. Without rotation of the parent, it's easy to find the global point of the child, parent.localToGlobal. However, when I'm rotating the parent, it seems that localToGlobal returns the incorrect x,y.

1
What do you mean by incorrect? Are you expecting the same x,y that you got without any rotation of the parent? Please elaborate more and post some code and some traced output to understand your question better. - Gurtej Singh
It should be correct, but it's easy to get confused as to what the input point should be. To the find the "global point of the child" you would't typically use parent.localToGlobal as you say, you would use child.localToGlobal. - Aaron Beall
By "global point" do you mean the top left point i.e. (0,0) of the child, translated into global space? - Nicko

1 Answers

0
votes

localToGlobal deals with position not transformation. You are simply using the wrong tool for the job. I'm guessing you don't want to deal with matrices but you gonna have to.

mydisplayobject.transform.pixelBounds;//global space occupied by object
mydisplayobject.transform.concatenatedMatrix//the matrix representing all combined transofrmations