I have a script that tries to loop through a small array of Google Maps DirectionsRequest objects; I need a way to make the script wait until the DirectionsService responds, so I can save the result before making the next request query. -I know in the older version you could set up something like the following:
directions = new GDirections(null, null);
directions.load("from: " + fromAddr + " to: " + toAddr);
GEvent.addListener(directions, "load", function() {...});
but the v3 documentation seems to deal mostly with listeners for map events (I don't want a map, just directions data). With v3, you have to set a callback function when you call the route() method. Is there an elegant way to pause my loop so it doesn't make a new request query before the previous one gets a response? -Or do I have no choice but to create a new instance of DirectionsService for each query?
Thanks for your help!
Carl