I am trying to have a single parent class that a wide variety of classes can extend. Each of them has the exact same event listeners and remove function so I thought I would try to write the function a single time in the parent class.
Parent Class:
public function removeMe():void {
/* REMOVE EVENT LISTENERS */
}
Child Class:
public class Child extends Parent {
public function Child() {
addEventListener(Event.ADDED_TO_STAGE, beginClass);
}
private function beginClass(e:Event):void {
addEventListener(Event.ENTER_FRAME, eFrame);
addEventListener(MouseEvent.CLICK, clicked);
}
private function eFrame(e:Event):void {
/* DO STUFF */
}
private function clicked(e:MouseEvent):void {
/* DO MORE STUFF */
}
}
The event listeners are not defined in the parent class and, therefore, I cannot remove them through normal means. Is there any easy way to remove these listeners through the parent class or at least make them known to the parent class?