I have a class “BaseMenu”, which, needless to say, is a base class to menus that have eventlisteners.
When I trigger the function to remove the menu itself, I don’t know how to remove these eventlisteners, since their respective functions are in the extended classes, not in “BaseMenu”.
What should I do?
//...
public function BaseMenu()
{
this.cacheAsBitmap = true;
alpha = 0;
y = 400;
}
public function unload(loadMe:BaseMenu = null) : void
{
if (loadMe != null)
loadNext = loadMe;
TweenMax.to(this, 0.7, { transformMatrix: { y:-stage.stageHeight }, onComplete: remove} );
TweenLite.to(this, 1.7, {autoAlpha:0});
}
public function remove() : void
{
// I would like to remove all eventlisteners from "this"
dispatchEvent(new Event("menuRemoved"));
if (stageRef.contains(this))
stageRef.removeChild(this);
if (loadNext != null)
loadNext.load();
}
//...