Hi,
I have multiple routes to various destinations. So far, using 1
GDirections object worked fine. But now I would like to get the
distances from all the routes.
Something like this:
------------------------------------------------------------------------------------
var routes = [];
var distances = [];
var directions = new GDirections(map, document.getElementById
("route"));
...
for (i = 0; i < routes.length; i++) {
directions.load(routes[i]);
GEvent.addListener(directions[i],"load", function() {distances[i] =
directions.getDistance().meters; alert(distances[i]);});
}
-------------------------------------------------------------------------------------
doesn't work obviously. But neither does the following work:
-------------------------------------------------------------------------------------------
var routes = [];
var distances = [];
var directions = [];
...
for (i = 0; i < routes.length; i++) {
directions[i] = new GDirections(map, document.getElementById
("route"));
directions[i].load(routes[i]);
GEvent.addListener(directions[i],"load", function() {distances[i] =
directions[i].getDistance().meters; alert(distances[i]);});
}
--------------------------------------------------------------------------------------------
Thanks
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---