Hi all,This might be quite obvious to some of you, bu I can't get my head around this problem : basically, I'm trying to reverse geocode a collection of points, but due to the Asynchronous nature of the Locator Task, I only get the last result populated...Here is a bit of code, I must do something fundamentally wrong here :private function getAddress(myPoints:ArrayCollection):void
{
for each (var myPoint:Object in myPoints)
{
locateTask.addEventListener(LocatorEvent.LOCATION_TO_ADDRESS_COMPLETE, locateTask_locationToAddressCompleteHandler);
locateTask.locationToAddress(myPoint.point, 100);
function locateTask_locationToAddressCompleteHandler(event:LocatorEvent):void
{
var candidate:AddressCandidate = event.addressCandidate;
if (candidate && candidate.address && candidate.address.Name)
{
var address:Object = candidate.address;
myPoint.address = address.Name;
}
else
{
myPoint.address = "N/A";
}
locateTask.removeEventListener(LocatorEvent.LOCATION_TO_ADDRESS_COMPLETE, locateTask_locationToAddressCompleteHandler);
}
}
}
Many thanks for your help....