Thank you so much Matt. I was stuck on the same issue too. your post helped me solve the "point-click-update-latlong-coordinate" thing. however though i see another slight problem when the user moves the point. the coordinate wont save. as the coordinate save only "on click". unless of course if the user clicks on the point again after the "moves". is this problem apply to yours too? here is my codes:
//-My changes start-//
public static const LAT:String = "lat";
public static const LON:String = "lon";
public var longitude:String;
public var latitude:String;
import widgets.Coordinate.DegToDMS;
import mx.formatters.NumberBaseRoundType;
private function MapClicked(event:MouseEvent):void
{
var mapPoint:MapPoint = map.toMapFromStage(event.stageX, event.stageY);
const latlong:MapPoint = WebMercatorUtil.webMercatorToGeographic(mapPoint) as MapPoint;
longitude = DegToDMS.format(latlong.x,"lon");
latitude = DegToDMS.format(latlong.y,"lat");
}
//-My changes end-//
private function basewidget_widgetConfigLoaded(event:Event):void
{
numberFormatter.precision = parseFloat("6"); //-My changes-//
map.addEventListener(MapMouseEvent.MAP_CLICK, MapClicked); //-My changes-//
// hide map infowindow if any
map.infoWindow.hide();
if (configXML)
{
if (GeometryServiceSingleton.instance.url) // using GeometryServiceSingleton
{
...
...
...
}
private function featureLayer_selectionComplete(event:FeatureLayerEvent):void
{
for each (var field:Field in event.target.layerDetails.fields)
{
if (field.type == Field.TYPE_DATE)
{
for each (var feature:Graphic in event.features)
{
var date:Date = new Date(feature.attributes[field.name]);
if (date.milliseconds == 999)
{
date.milliseconds++; //Add 1ms to date values ending in 999 to workaround REST date bug
feature.attributes[field.name] = date.time;
}
}
}
//-My changes start-//
if (field.name == "Longitude")
{
//var feature:Graphic;
feature.attributes[field.name] = longitude;
event.featureLayer.applyEdits(null, [feature], null)
}
if (field.name == "Latitude")
{
//var feature:Graphic;
feature.attributes[field.name] = latitude;
event.featureLayer.applyEdits(null, [feature], null)
}
//-My changes end-//
}
}
... View more