Flash and flex provide 3 different coordinate systems for different purposes.
The overall situation is (stage level)
Local coordinate system (component level)
The content coordinate system (as opposed to the local coordinate system)
The points of these coordinate systems can be converted, and there are corresponding methods, and it seems that Adobe is very thoughtful. Let's say one at a moment:
Global
The origin of this coordinate system is in the upper-left corner of the entire flash stage, and the stagex,stagey of the MouseEvent instance is the value in this coordinate system.
Local
The coordinate origin is the upper-left corner of the relative component, and the localx,localy in the MouseEvent is said to be relative to the coordinate system.
Content
This thing is more abstract UIComponent class instance of the contentmousex and contentMouseY is, this is mainly for the components of the scroll bar, there is a scroll bar, the content is certainly a lot, the content of the area of the coordinates is this coordinate system.
Here's an official diagram that illustrates the relationship and location of three coordinate systems:
. net/art/20091003/r91tmcxl6zxhy7o.jpg "target=" _blank ">
There are also ready-made methods for coordinate conversion:
contentMouseX |
Returns the content coordinate x value of mouse |
contentMouseY |
Returns the content coordinate Y-value of mouse |
contentToGlobal |
Convert content coordinates to global coordinates |
contentToLocal |
convert content coordinates to content coordinates |
globalToContent |
Turn Global to content coordinates |
globalToLocal |
Global turn to Local |
localToContent |
Local to content coordinates |
localToGlobal |
Local to global coordinates |
Here is a small example: