Vinzcent
Vinzcent

Reputation: 1448

EventListener function in parent class

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

Upvotes: 1

Views: 349

Answers (1)

daniel.sedlacek
daniel.sedlacek

Reputation: 8629

Use super statement.

showcaseItem.addEventListener("CONTENTMCCLOSED", super.restoreMenuItem); 

Upvotes: 3

Related Questions