On May 21, 1:16 pm, geomartino <[email protected]> wrote: > 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?
It works for me. Sounds like pitfall #3 here: http://econym.org.uk/gmap/basic1.htm how are you associating the click listeners with the polylines? If this doesn't help, you could also try following the posting guidelines: http://groups.google.com/group/google-maps-api/web/suggested-posting-guidelines http://groups.google.com/group/Google-Maps-API/web/why-including-a-link-is-critical -- Larry > > -- > 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 > athttp://groups.google.com/group/google-maps-api?hl=en. -- 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.
