AS3: Removing EventListeners without knowing amount or names

Posted by DevEight on Stack Overflow See other posts from Stack Overflow or by DevEight
Published on 2010-04-28T18:29:25Z Indexed on 2010/04/28 18:37 UTC
Read the original article Hit count: 217

Hello!

First shortly about how my site works: When a link is clicked it checks if something is already displayed in either the Left or Right side of the screen (the website looks like a book, so I have a left page I want to display information on and a right page). If there is already something showing it hides it and displays the new object, together with this it enables all the buttons within that object (I have separate functions to set up each object).

An example of such an EventListener would be:

pathTo.Button1.addEventListener(MouseEvent.CLICK, function():void {showText(side, object)});

What I'm trying to do is to remove all the previous set EventListeners without having to create separate functions for removing the links inside every object as well.

Shorter version: How do I remove all EventListeners on all objects inside another object? The only variable I want to store is the object containing everything. There are however not always EventListeners within the objects.

© Stack Overflow or respective owner

Related posts about flash

Related posts about actionscript-3