somewhat simple problem(to explain) this time:
i have an array of markers that i equip with eventlisteners thusly:
for (i in markersArray) {
google.maps.event.addListener(markersArray[i], 'click', function() {
//stuff it does
google.maps.event.removeListener(?????) //remove self... but HOW?!
});}
as i mention in the comment, i simply want the listener to be removed once it is clicked.
problem is that i dont know what the handle for the listener is.
Click the marker to reveal the editing options. Click the "Delete" link in the lower-left corner of the dialog box.
To remove a marker from the map, call the setMap() method passing null as the argument. marker. setMap(null);
The use of markers in the map is quite limited but you can put up to 50 markers on a map in 10 different colors and in 3 different sizes with an optional letter in it on the map.
You can use the "addListenerOnce". Then you don't even have to bother with removing the listener.
addListenerOnce(instance:Object, eventName:string, handler:Function)
Like event.AddListener, but the handler removes itself after handling the first event.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With