While-loop is a dumb idea and will not be appreciated by users whose browsers lock up and/or spit "taking too long" messages. We all try to invent that method to deal with asynchronous events, but it is NOT the right way. Re-write your code to be event driven, though this is hard to grasp first time out.
It's not particularly easy, because the Directions service is not meant to be used like this. Here's a well-known example, it does multiple geocoding but the principles are exactly the same. Set up a data array, work through it, handling errors as you go, then take some action at the end. http://econym.org.uk/gmap/geomulti.htm -- 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.
