Hi guys, I have written this code that loops through an array of lat/long coordinates and places a marker at each of the coordinate. Everything forks fine, exempt the info window won't appear once the marker is clicked.
var ExpTowerIcon = new GIcon();
ExpTowerIcon.image = "tower.png";
ExpTowerIcon.iconSize = new GSize(75, 75);
ExpTowerIcon.iconAnchor = new GPoint(37, 65);
ExpTowerIcon.infoWindowAnchor = new GPoint(37, 20);
var marker=new Array();
for ( i=0 ; i < lat.length ; i++ ) {
var MarkerPoint = new GLatLng(lat[i],long[i]);
marker[i] = new GMarker(MarkerPoint,{icon:ExpTowerIcon})
map.addOverlay( marker[i] );
GEvent.addListener( marker[i] , 'click', function() { marker[i].openInfoWindowHtml('Hello!') ; });
var polyline = new GPolyline([ new GLatLng(lat[i],long[i]) , new GLatLng(lat[i+1],long[i+1]) ], "#ff0000", 5);
map.addOverlay(polyline);
}
Any ideas? Thanks!