> Sry but I think I did post the link:http://novitonics.blogia.com/

My fault, I though that was an example you were basing yours on.

Your function compareCandidates() tries to use the results of
asynchronous calls before they are available, it won't work.  Once the
GDirections call has been issued, javascript processing doesn't stop ;
in your function it carries on to do the testing.  Sometime later, the
results come back from Google, and your 'load' listener is triggered,
but that does no testing.

You need to somehow wait until the results have returned before trying
to do comparisons.

One way might be to set up an array of all the sets of directions you
need to get, and then work through the array issuing directions
calls.  Set up another array to hold results as they are returned -
they might come back in random order, you can't rely on responses
coming in the same order as requests unless you do one at a time..
Each time you get a result, test to see if you have them all.  If you
do have them all, then do your comparison testing.

You will almost certainly have to add a delayed retry capability,
because the directions service has a speed limit to prevent people
hogging the resource.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps 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-maps-api?hl=en.

Reply via email to