private function mouseClickHandler(event:MouseEvent):void
{
const frmapPoint:MapPoint = map.toMapFromStage(event.stageX, event.stageY);
var latlong:MapPoint;
var wkidString:String = frmapPoint.spatialReference.wkid.toString();
//Alert.show("Spatial Ref for map: " + frmapPoint.spatialReference.wkid.toString());
if ( wkidString == "102100")
{
latlong = WebMercatorUtil.webMercatorToGeographic(frmapPoint) as MapPoint;
frLat = latlong.y.toFixed(6);
frLong = latlong.x.toFixed(6);
displayForm(frLat, frLong);
}
else if ( wkidString == "3857")
{
latlong = WebMercatorUtil.webMercatorToGeographic(frmapPoint) as MapPoint;
frLat = latlong.y.toFixed(6);
frLong = latlong.x.toFixed(6);
displayForm(frLat, frLong);
}
else if ( wkidString == "4326")
{
latlong = map.toMapFromStage(event.stageX, event.stageY);
frLat = latlong.y.toFixed(12);
frLong = latlong.x.toFixed(12);
displayForm(frLat, frLong);
}
else
{
//Alert.show("Non client side projection");
var outSR:SpatialReference = new SpatialReference(4326);
geometryService.project([frmapPoint as Geometry], outSR);
}
var graphic:Graphic = new Graphic();
var mapPoint2:MapPoint = frmapPoint;
mapPoint2.spatialReference = map.spatialReference;
graphic.geometry = mapPoint2;
graphicsLayer.clear();
graphicsLayer.add(graphic);