Hello guys,
I'm trying to change the infoWindow when loading a map with
loadFromWaypoints, but it won't working. (result is an array that I
created outside the function, so just trust that's ok).
function showMap(){
function changeMarkers(){
for (var i = 0; i < result.length; i++) {
var marker = directions.getMarker(i);
GEvent.addListener(marker, "click", function() {
alert(1);
marker.openInfoWindow("bla");
});
}
}
if (GBrowserIsCompatible()) {
var map = new GMap(document.getElementById("map"));
map.addControl(new GLargeMapControl());
map.addControl(new GMapTypeControl());
var waypoints = new Array();
for (var i = 0; i < result.length; i++) {
var coordinates = result[i];
waypoints[count++] = coordinates.latitude + "," +
coordinates.longitude;
}
var directions = new GDirections(map);
directions.loadFromWaypoints(waypoints);
GEvent.addListener(directions, "load", changeMarkers);
}else if(!GBrowserIsCompatible()){
alert(G_GEO_INCOMPATIBLE_BROWSER);
}
}
The most strang is that if I click in the markers, the alert(1) shows
up, but the infoWindow remais the default. Any idea?
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---