I’ve got a few MouseEvent listeners outside of a function that contains nested functions that need to use the functions attached to the listeners.
button1.addEventListener(MouseEvent.ROLL_OVER, buttonOver);
function navigation (): void {
if statements;
function buttonOver(event:MouseEvent):void {
movieclip.play();
}
}
I keep getting an “1120:Access of undefined property buttonOver” error. I know it’s because the EventListener is outside of the function “navigation” but I need it to be accessed by other functions later. Am I going about this all wrong?
That won’t work. I don’t think you should nest functions. Why don’t you use a class instead that you can access from other classes / instances?
Rob