Long time AS2 programmer making the switch to AS3. I’m testing out some of the things with button events and have a straight forward question.
Here is the code I’m trying to run:
Code:
function theTest() {
trace(“hey”);
}
zeButton.addEventListener(MouseEvent.MOUSE_UP, theTest());
and here is the error it produces:
Code:
TypeError: Error #2007: Parameter listener must be non-null.
at flash.events::EventDispatcher/addEventListener()
at sender_fla::MainTimeline/frame1()
So is it not possible to directly refrence a csutom function from an event listener? Am I always stuck calling a custom event like so?
Code:
zeButton.addEventListener(
MouseEvent.MOUSE_UP,
function(evt:MouseEvent):void {
theTest();
}
);
function theTest() {
trace(“hey”);
}
Thanks!
.