Hello! I have a LevelSelecMenu clip which shows menu, where you have to choose a level to play, when you click on the Level 1 button, it loads Level 1. I need to delete Level1 from stage(if level is done), but I have an Error #1009. Please help me to figure out the problem.
LevelSelecMenu
package {
import flash.display.MovieClip;
import flash.display.SimpleButton;
import flash.events.MouseEvent;
public class LevelSelectMenu extends MovieClip {
public static var level_1:Level_1;
public function LevelSelectMenu() {
Level_1Button.addEventListener(MouseEvent.CLICK, Level_1ButtonClick);
}
private function Level_1ButtonClick(e:MouseEvent) {
level_1=new Level_1();
stage.addChild(level_1);
}
}
}
[COLOR=#000000]
[/COLOR]
Level_1
[LEFT]
package {
import flash.display.MovieClip;
public class Level_1 extends MovieClip {
public function Level_1() {
stage.removeChild(LevelSelectMenu.level_1);
}
}
}
[/LEFT]