Good afternoon mappers. I have 50-odd tracks across the Pacific, and I'd like to have some sort of popup or info window when mousing over each one. I am stuck at phase one. I can add a listener to each polyline, but they all seem to point to the LAST polyline in the list.
The link to the website is http://pacificcup.org/OpenLayers/testbutton.html For development, I am just trying to get the boatname in the box at the top of the page. Once I can get that to change, I'll do the real mouseover code. Thanks all! Any help is appreciated. ----- The operative code is below: function addTrace(marks){ var bIx = 0; var myPath = []; for (var c =1; c<marks.length; c++) { if (!isNaN(marks[c][2])){ var myLatLon = myPath.push(new google.maps.LatLng(marks[c][2], marks[c][3])); }; // on name change start a new path if (marks[c][0] != marks[c+1][0]){ var bName = marks[c][0]; myColor[bIx] = colors[bIx%6]; lines [bIx] = new google.maps.Polyline({ path: myPath, strokeColor: myColor[bIx], strokeOpacity: .5, strokeWeight: 2 }); lines[bIx].myName = bName; lines [bIx].baseCol = myColor[bIx]; var polyMine = lines[bIx]; //*** HERE IS THE TROUBLED PART***/ google.maps.event.addListener( polyMine, 'mouseover', function() { $("#textBox").html("Source is listener "+ polyMine.myName ); }); addLabel( marks[c][0], 'boat', bIx); lines [bIx].setMap(map); myPath = []; bIx++; //increment the index counter } } } // end addtrace -- You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" 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-js-api-v3?hl=en.
