Flex Coordinate System

Source: Internet
Author: User

Global coordinate (stage coordinate) local coordinate content coordinate system map coordinate (mappoint)

Flash and flex provide three different coordinate systems for different purposes

Global is (stage-level)

Local Coordinate System (component-level)

Content coordinate system (relative to the local coordinate system)

Map coordinate (mappoint)

The points in these coordinate systems can be converted, and there are corresponding methods. It seems that Adobe is very thoughtful. Let's talk about it one by one.

Global

The origin of this coordinate system is in the upper left corner of the entire flash stage. stagex and stagey of the mouseevent instance are values in this coordinate system,

Local

The coordinate origin is the upper left corner of the relative component. localx and localy in mouseevent are relative to the coordinate system,

Content

This is a abstraction of the contentmousex andContentmouseyThat's it. This is mainly for the component with a scroll bar. If there is a scroll bar, there must be a lot of content. The coordinates of the area occupied by the content are the coordinate system.

Map coordinate (mappoint)

This is mainly the coordinate point on map in ArcGIS.

The following official figure shows the relationship and position of the Three Coordinate Systems:

There are also ready-made methods for Coordinate Transformation

 

Contentmousex

Returns the coordinates x of the mouse content.

Contentmousey

Returns the Y value of the mouse coordinate.

Contenttoglobal

Convert the content into global coordinates

Contenttolocal

Convert content into content coordinates

Globaltocontent

Convert global coordinates to content coordinates

Globaltolocal

Global to Local

Localtocontent

Coordinates from local to content

Localtoglobal

Local to global coordinates

 

 

 

 

 

Map. toscreen (): mappoint ----> local coordinates

Map. localtoglobal (): local coordinates ---> Global coordinates

Map. globaltolocal (): Global coordinate ---> Local Coordinate

Map. tomapfromstage (): Global coordinate ---> mappoint

_ Sprite. globaltolocal (): Global coordinate ---> Local Coordinate

Flex Coordinate System

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.