?
Then use the toMapFromStage method to easily get those stage coordinates into map coordinates.
-->
??? <mx:Script>
??????? <![CDATA[
??????????? import com.esri.ags.geometry.MapPoint;
??????????? private function loadHandler():void
??????????? {
??????????????? myMap.addEventListener(MouseEvent.MOUSE_MOVE,mouseMoveHandler);
??????????? }
??????????? private function mouseMoveHandler(event:MouseEvent):void
??????????? {
??????????????? const mapPoint:MapPoint = myMap.toMapFromStage(event.stageX,event.stageY);//获取当前鼠标的坐标转换成点。
??????????????? mousecoords.text = "Latitude: " + mapPoint.y.toFixed(6)?//点的Y值坐标(保留六位小数)
??????????????????? + "??? Longitude: " + mapPoint.x.toFixed(6);
??????????? }
??????? ]]>
??? </mx:Script>
??? <mx:HBox width="100%">
??????? <mx:Label text="Current map extent:" fontWeight="bold"/>
??????? <mx:Label text="xmin: {myMap.extent.xmin.toFixed(3)}"/>//地图显示范围的最小X值并保留三位小数
??????? <mx:Label text="ymin: {myMap.extent.ymin.toFixed(3)}"/>
??????? <mx:Label text="xmax: {myMap.extent.xmax.toFixed(3)}"/>
??????? <mx:Label text="ymax: {myMap.extent.ymax.toFixed(3)}"/>
??? </mx:HBox>
??? <mx:HBox width="100%">
??????? <mx:Label text="Current Mouse Coordinates:" fontWeight="bold"/>
??????? <mx:Label id="mousecoords" text="Move the mouse over the map to see its current coordinates..."/>
??? </mx:HBox>
??? <mx:HBox width="100%">
??????? <mx:Label text="Current map scale:" fontWeight="bold"/>
??????? <mx:Label text="1:{myMap.scale.toFixed(0)}"/>//地图比例尺(无小数位)
??? </mx:HBox>
??? <esri:Map id="myMap" load="loadHandler()">
??????? <esri:extent>
??????????? <esri:Extent xmin="-11" ymin="30" xmax="40" ymax="72">
??????????????? <esri:SpatialReference wkid="4326"/>
??????????? </esri:Extent>
??????? </esri:extent>
??????? <esri:ArcGISTiledMapServiceLayer
??????????? url="http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_Imagery_World_2D/MapServer"/>
??? </esri:Map>
</mx:Application>
?
http://1984yifeng.blog.163.com/blog/static/4728439120100273342756/