Hey Gareth --
Yeah, code would be best!  But it looks like you need the power of closures.
 I wrote a post on this awhile back that was pretty detailed, so I'm going
to link you to that rather than re-type it.  Closures are a bit confusing
when you first learn them, but hopefully my explanation helps:
http://groups.google.com/group/Google-AJAX-Search-API/browse_thread/thread/f7702c297684c1b/

Regards,
Ben

On Tue, Oct 14, 2008 at 8:34 AM, GarethE <[EMAIL PROTECTED]> wrote:

>
> I'm using a GlocalSearch to find the exact lat and lng for an array of
> addresses and then passing an array of GLatLng from each top result to
> GDirections (from what I've read this is necessary here in the UK).
>
> I've been able to loop the array of address and have set up
> setSearchCompleteCallbacks for each one with a push into an array of
> GLatLng items created from the lat and lng of the top search result.
>
> The fun part is of course the callbacks can complete in any order so
> the directions are often messed up. Is there a way to pass a sequence
> value from the loop to each callback so the GLatLng items can be put
> in their array in the same order as the addresses they came from? i.e.
> the GLatLng created from the top search result of the first address
> would always go into position 1, second address position 2, etc.
>
> You can probably tell I'm new to asyncronous programming! - If there's
> a simpler way to do the same thing I'm all ears.
>
> Code happily provided on request and thanks in advance.
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google AJAX API" 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-AJAX-Search-API?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to