Hi all,
I create encoded polylines and I try to pass an argument(ID of the
line) for the click event just like this:
/*array
aValue[0] = unique ID for each polyline
aValue[1] = color
aValue[2] = encoded points
aValue[3] = encoded level
*/
for (var i=0; i<rawdata.length; i++){
var aValue = rawdata[i].split(";");
html = aValue[0];
polyline = new GPolyline.fromEncoded({color: aValue[1],
weight: 4,
opacity: 0.8,
points: aValue[2],
levels: aValue[3],
numLevels: 18,
zoomFactor: 2});
GEvent.addListener(polyline, 'click', function(){
alert('you clicked polyline with ID:' + html);
}
);
map.addOverlay(polyline);
But the alert always display the ID of the last polyline in the
array. Any ideas WHY?
--
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.