You could use a function to hold Function Closure on all the variables
you need.

function listen(i) {
  GEvent.addListener(newMarkers[i], "click", function(){
    newMarkers[i].openInfoWindowHtml(newMarkers[i].getTitle());
  });
}

...

   for (var i=0; i<=gdir.getNumRoutes(); i++) {
     listen(i);
   }

My attempt at explaining Function Closure is here, in case you want to
try to understand what's going on:

  http://econym.org.uk/gmap/closure.htm


-- 
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to