EventListener function in parent class
-
30-09-2019 - |
Question
I have class ShowCase that inherite from my class ContentMC (that inherite from MovieClip). In the class ShowCase I have an EventListner that calls a function in the parent class ContentMC. But I get an error that says "Access of undefined property restoreMenuItem".
This is my eventlistner in ShowCase.as.
showcaseItem.addEventListener("CONTENTMCCLOSED", restoreMenuItem);
Here I get the error, it doesn't find the function restoreMenuItem.
The function restoreMenuItem is in ContenMC and looks like this.
public function restoreMenuItem(evt:Event):void
{
}
How do I call this function that's in the parent?
Thanks, Vincent
Solution
Use super statement.
showcaseItem.addEventListener("CONTENTMCCLOSED", super.restoreMenuItem);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow