Okay, I am having some trouble removing my listeners for my markers when I
am in the process of clearing them out of my marker manager.

I have added my markers as such:

var StartMarker = new GMarker(point1, ZoneStartMarkerOptions);
var FinishMarker = new GMarker(point2, ZoneFinishMarkerOptions);
ZoneStartFinishMarkers[idStart] = StartMarker; //  Adds to our
ZoneStartFinishMarkers at our ZoneID * 2
GEvent.addListener(ZoneStartFinishMarkers[idStart], "dragend", function(){ //
 Creates the Listener for the StartMarker
        var Point = StartMarker.getPoint(); //  Gets the new location of the
marker
var ZoneID = StartMarker.getTitle(); //  Sets the ZoneID to the ID of the
Zone set in the title above
var pointb = FinishPoints[idFinish]; //  Gets the Point of the Finish Marker
Distance = point1.distanceFrom(pointb); //  Gets the Distance from the
Finish Marker
UpdateString = "S," + ZoneID + Point + Distance; //  Sets the update string
to the new location - S indicates Start
} );
ZoneStartFinishMarkers[idFinish] = FinishMarker; //  Adds to our
ZoneStartFinishMarkers at our ZoneID * 2 + 1
GEvent.addListener(ZoneStartFinishMarkers[idFinish], "dragend", function() { //
 Creates the Listener for the FinishMarker
var Point = FinishMarker.getPoint(); //  Gets the new location of the marker
var ZoneID = FinishMarker.getTitle(); //  Sets the ZoneID to the ID of the
Zone set in the title above
var pointb = StartPoints[idStart]; //  Gets the Point of the Start Marker
Distance = point2.distanceFrom(pointb); //  Gets the Distance from the Start
Marker
UpdateString = "F," + ZoneID + Point + Distance; //  Sets the update string
to the new location - F indicates Finish
} );

Afterwards I add the ids of the listeners to an array as such:
StartListeners.push(idStart);
FinishListeners.push(idFinish);

Now I am trying to call a function to remove the listeners when I am getting
ready to destroy the markers and I am doing it like so:
function ClearStartFinishMM() {
        alert("ClearStartFinishMM");
if(ZoneStartFinishMM) {
alert(StartListeners.length);
alert(FinishListeners.length);
for(var i = 0; i < FinishListeners.length; i++) {
alert("StartListeners pos " + i + " = " + StartListeners[i]);
alert("FinishListeners pos " + i + " = " +FinishListeners[i]);
var pointerS = StartListeners[i];
var pointerF = FinishListeners[i];
GEvent.removeListener(StartFinishMarkers[pointerS]);
GEvent.removeListener(StartFinishMarkers[pointerF]);
}
ZoneStartFinishMM.clearMarkers();
}
       return;
}

Now, my array lengths are the length that they are supposed to be, but when
I try to remove the listener I get a StartFinishMarkers is undefined.  Any
ideas?

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

Reply via email to