I discovered encountered something weird today. I have a function with a Boolean default parameter:
function f(boolean:Boolean=false) {
trace(boolean);
}
Calling it normally gives what you would expect:
f(); //traces false
But now if I make my function the callback for an Event Listener, something weird happens:
addEventListener("test",f);
dispatchEvent(new Event("test")); //traces true
The same thing happens if I make it a callback for clicking on something:
mySprite.addEventListener(MouseEvent.CLICK,f); //Traces true on click
Can anyone explain what is going on? What is happening to my default value of false? When the event listener calls my function, it's not passing any parameters.