The while loop would be much better, as you will have a very hard time
determining the time interval it takes to calculate the distance and it
won't be the same for every person.

On Fri, Jul 2, 2010 at 7:19 AM, novitonics <[email protected]> wrote:

> Thx m8 this post reply is very useful indeed.
> Now I will try to implement a delay which will probably bust
> performance my performance though. ;(
> I'm thinking about a while loop which does nothing until both
> distances are returned (AK: untill the variables which are designated
> to hold the distance have a different value other than null)
> Another option which is waaaay less elegant is right before the
> comparisson do something like this:
>     for i=0 to 10000
>          for i=0 to  100000
>                 ......................
>                DO NOTHING BUT IDLE........
>
> and execute it several times til the response time suites the google
> response. I'll try both & see what comes out from this and try to post
> back ASAP to let you guys know about the outcome of my tests
>
> cya thanks again Rossko  :D
>
>
> On Jul 2, 1:48 pm, Rossko <[email protected]> wrote:
> > > 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]<google-maps-api%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/google-maps-api?hl=en.
>
>

-- 
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