Is possible to remove an event listener in actionscript 3 (flash) ??

Posted by DomingoSL on Stack Overflow See other posts from Stack Overflow or by DomingoSL
Published on 2010-12-31T15:35:30Z Indexed on 2010/12/31 15:54 UTC
Read the original article Hit count: 130

Filed under:
|

In the frame 1 of my movie, part of my code is:

stage.addEventListener(Event.RESIZE, resizeHandler);

It works all fine, but when i go to the frame 2 the listener is still there but the function resizeHandler is not anymore (and i dont want it). So the console output this:

TypeError: Error #1009: Cannot access a property or method of a null object reference. at index_fla::MainTimeline/resizeHandler() at flash.events::EventDispatcher/dispatchEventFunction() at flash.events::EventDispatcher/dispatchEvent() at flash.display::Stage/dispatchEvent() at index_fla::MainTimeline/frame2()

Is possible to remove the event listener on the frame 2? Thanks!!!

© Stack Overflow or respective owner

Related posts about flash

Related posts about actionscript-3