Tuesday, 24 November 2009

Remove an event listener in Actionscript 3

If you want to remove or delete an event listener from an event in Actionscript 3, you need to use the removeEventListener() method. Removing an event is similar to adding an event as you need to include the type and listener for the parameters. So, the method would look something like below:


The example of this method below removes the mouse click event from the stage instance.

stage.removeEventListener(MouseEvent.CLICK, clickingExample);

Removing an event listener reduces memory and processor usage, so it’s good coding practice to remove an eventListener when it is no longer needed in a program. You need to again include the event type and the listener parameters.


  COPYRIGHT © 2014 · ILIKE2FLASH · Theme by Ourblogtemplates

Back to TOP