You seem to be adding the listener multiple times when you call

 for (var i = 0, c = fs.length; i < c; i++) {
    setupFeature(fs[i]);
 }

but then you remove it only once.

What you can do instead is to add the map click listener as soon as
the map is created and leave it active, and then inside that function
check a global boolean variable, for example:

var drawing = false; // global
...

// Inside the click listener
if (drawing == true) {
  // do one thing
}
else {
  // do another
}

--
Marcelo - http://maps.forum.nu
--




On Dec 16, 10:35 am, Andrew <[email protected]> wrote:
> Hi I have a listener called MyCountyListener that when the page is loaded
> you can click on anywhere in Illinois and an infowindow will popup with a
> link to that county's webpage. This works fine.
>
> I want it so that when I click on the "Measure Distance" button below my
> map, this listener goes away, and therefore I will be able to draw a
> polyline. Right now I am only able to draw a polyline outside of Illinois.
>
> My page is here:https://netfiles.uiuc.edu/alouchio/shared/mines.shtml
>
> I currently have
> google.maps.event.removeListener(MyCountyListener)
> in my draw polyline function, but that is not working.
>
> Thank you.

-- 
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.

Reply via email to