Hi CPR-AL-
Okay, I understand. I suggest the following technique:
- Create a global variable called totalGeocodeNum
- Create a function-scope variable called currentGeocodeNum
- Each time you geocode, increment totalGeocodeNum and set currentGeocodeNum
to that value
- In the callback for the geocoder, only process the response if
currentGeocodeNum == totalGeocodeNum
Some code shown below - it's hard to test since I the geocode requests are
actually very fast.
private var totalGeocodeNum:uint=0;
private function doGeocode(event:Event):void
{
totalGeocodeNum++;
var currentGeocodeNum:uint =geocodeNum;
var geocoder:ClientGeocoder=new ClientGeocoder();
geocoder.addEventListener(GeocodingEvent.GEOCODING_SUCCESS,
function(event:GeocodingEvent):void
{
if (currentGeocodeNum == totalGeocodeNum)
// do stuff
}
});
geocoder.geocode(address.text);
}
- pamela
2009/3/22 [CPR]-AL.exe <[email protected]>
>
> Hello, Pamela.
>
> I was trying to umgh... "abort" geocoding request.
>
> I have a "Search" button, and the user can click on it before the
> previous GeoResponse is received, so there will be to requests and to
> responses, and I need only the last one. I suppose, that i can just
> create a new geocoder for the same reference variable, but I thought,
> that the clearWrapper method is able to "abort" the georequest
> (meaning, just ignore the old response).
>
> Don't know if could make myself clear... Sorry for my bad english.
>
> On 21 мар, 01:42, pamela fox <[email protected]> wrote:
> > Hi CPR.AL-
> >
> > I think that the clearWrapper methods may have been accidentally
> > documented; I'm not sure that they're for developer use (I'll confirm
> > with the team soon). What are you trying to accomplish?
> >
> > - pamela
> >
> > On Fri, Mar 20, 2009 at 3:28 AM, [CPR]-AL.exe <[email protected]>
> wrote:
> >
> > > I cannot call ClientGeocoder.clearWrapper():
> >
> > > ----
> > > geocoder = new ClientGeocoder()
> > > geocoder.addEventListener(GeocodingEvent.GEOCODING_SUCCESS,
> > > geocodeSuccessHandler)
> > > geocoder.clearWrapper()
> > > ----
> >
> > > I've got an error saying, that clearWrapper is undefined.
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Maps API For Flash" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/google-maps-api-for-flash?hl=en
-~----------~----~----~----~------~----~------~--~---