if you want to get a little fancy... here's a closure that returns a
class object with getter/setter methods to private variable used to
determine the click handler's behavior-


var userChoiceClickHandler = function(){
    var userChoice = "1";
    var clickHandler = GEvent.addListener(map, "click", function(){
        switch (true) {
            case (userChoice === "1"):
                alert("1");
                break;
            case (userChoice === "2"):
                alert("2");
                break;
            default:
                alert("whoops no option");
        }
    });
    return {
        getUserChoice: function(){
            return userChoice;
        },
        setUserChoice: function(newValue){
            userChoice = newValue;
        },
        clickHandler: clickHandler
    }
}();

userChoiceClickHandler.setUserChoice("2");

On Oct 14, 9:27 pm, Rossko <[EMAIL PROTECTED]> wrote:
> > I had always assumed that when the map was loaded all associated
> > listener's were loaded and that you could not dynamically reselect the
> > ones you want executed at runtime.  Instead, one would have to  remove
> > the listeners "GEvent.removeListener(handle)"  and add new ones as
> > required.  Is this the best way?
>
> Why not have one 'permanent' click listener that acts differently
> depending on the conditions in force at the time it is called?
--~--~---------~--~----~------------~-------~--~----~
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