Creating a Class that Removes a MovieClip
I would like to create a class that removes a movie clip as this is something that needs to be done frequently.
I have a button and in the library I have assigned it to the "Close" class (AS Linkage).
I created the following class:
package {
import flash.display.MovieClip;
import flash.display.SimpleButton;
import flash.events.MouseEvent;
public class Close extends MovieClip
{
//ContructorCode
public function Close()
{
closeButtonNow();
}
public function closeButtonNow():void
{
this.removeChild(this);
}
}
}
Depending on how I play with the code I get the following errors:
1061: Call to a possibly undefined method removeChild through a reference with static type Close.
5000: The class"Close" must subclass 'flash.display.SimpleButton' since it is linked to a library symbol of that type.
What am I doing wrong? I know it's something simple but I don't fully understand the use of "this".
