> I thought this would be easy using the GDirections object from the > API, but this does not work. Because there is some delay between the > directions.load() and the moment the distance is filled > (directions.getDistance().meters), so this gives me null errors.
That's right, GDirections is an asynchronous function. All the documentation, all the examples, all the tutorials, all the discussions in this group cover that aspect of GDirections and give guidance on how to use it correctly. Not sure how you've missed all that. Here's an example explanation - http://econym.org.uk/gmap/async.htm and you'll probably find other parts of the same tutorial quite useful too, such as - http://econym.org.uk/gmap/directions.htm and the pitfalls of multiple requests are covered here - http://econym.org.uk/gmap/geomulti.htm cheers, Ross K --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Maps API" group. To post to this group, send email to Google-Maps-API@googlegroups.com To unsubscribe from this group, send email to google-maps-api+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/Google-Maps-API?hl=en -~----------~----~----~----~------~----~------~--~---