Hi,
I'm new to Google Maps API developing, my problem is:
I'm using the marker manager to add markers, and I wanted to add a
"click" event for each marker (showing an openInfoWindow). The click
event works, but it opens the InfoWindow always on the same place
(coords). It's like every time the map loads, it only remain the last
position I called. My code (based on the documentation examples) is:
function getSpotMarkers(n,z) {
var batch = [];
var pos;
var spotmarker;
for (var i = 0; i < n; ++i) {
pos = getRandomPoint();
spotmrkr = new GMarker(pos);
GEvent.addListener(spotmrkr, "click", function(){
map.openInfoWindow(pos,document.createTextNode("HTML"));
});
batch.push(spotmrkr);
}
return batch;
}
function setupSpotMarkers() {
mgr = new MarkerManager(map);
mgr.addMarkers(getSpotMarkers(20,1), 1);
mgr.addMarkers(getSpotMarkers(200,6), 6);
mgr.addMarkers(getSpotMarkers(1000,8), 8);
mgr.refresh();
}
</script>
I'm wrong for sure..hehe...help?
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
-~----------~----~----~----~------~----~------~--~---