<?xml version="1.0" encoding="utf-8"?> <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:esri="http://www.esri.com/2008/ags" pageTitle="MapClick - click map to get current location"> <fx:Script> <![CDATA[ import com.esri.ags.events.MapMouseEvent; import com.esri.ags.geometry.MapPoint; import com.esri.ags.utils.WebMercatorUtil; import spark.components.TextArea; private function onMapClick(event:MapMouseEvent):void { var latlong:MapPoint = WebMercatorUtil.webMercatorToGeographic(event.mapPoint) as MapPoint; myMap.infoWindow.label = "You clicked at "; var textArea:TextArea = new TextArea(); myMap.infoWindow.content = textArea; textArea.text = "Lat/Long is: " + latlong.y.toFixed(6)+ " / " + latlong.x.toFixed(6); myMap.contextMenu.hideBuiltInItems(); myMap.contextMenu.clipboardMenu = true; textArea.selectable = true textArea.editable = false; textArea.mouseEnabled = true; myMap.infoWindow.show(event.mapPoint); // "Show the click" } ]]> </fx:Script> <esri:Map id="myMap" mapClick="onMapClick(event)" scale="50000000"> <esri:ArcGISTiledMapServiceLayer url="http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer"/> </esri:Map> </s:Application>