Why not have a global variable that counts the outstanding requests.
var requests = 0;
Increment it whenever you issue a request. Decrement it whenever a reply
or a failure comes back.
directions[i].load( ... );
requests++;
GEvent.addListener(directions[i],"load", function() {
distances[i] = directions[i].getDistance().meters;
requests--;
if (requests == 0) {
// finished
}
});
GEvent.addListener(directions[i],"load", function() {
alert("That one failed");
requests--;
if (requests == 0) {
// finished
}
});
--
http://econym.org.uk/gmap
The Blackpool Community Church Javascript Team
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---