Reputation: 15484
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!!!
Upvotes: 0
Views: 1067
Reputation: 355
In actionScript you can use:
stage.removeEventListener(Event.RESIZE, resizeHandler);
and that should remove your event handler.
Upvotes: 1