Hi,
I am creating markers in a loop, data is stored in an multidimentional
array and used in a loop.
The problem is that markers are created correctly but info windows
not: whatever marker I click info window is shown attached to the last
marker and with last info.
Here's the loop
for(var i = 0; i < points.length; ++i) {
var point = new GLatLng(points[i][0], points[i][1]);
var marker = new GMarker(point);
var description = points[i][2];
map.addOverlay(marker);
alert("description "+description+" marker "+marker.getLatLng());
GEvent.addListener(marker, "click",
function() {
marker.openInfoWindowHtml(description);
}
);
}
points here represent array of arrays:
points=[[lat, long, info], [lat, long, info], ...]
alert displays information correctly and as I indicated markers are
created at correct locations, but I'm really puzzled as to what causes
info windows to be registered only for the last marker and with the
last info only. Any ideas ?
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---