我正在尝试制作一个直升机游戏,并且我的游戏中添加了一个标题屏幕,但是每当我尝试 removeChild 时,该按钮都不会被移除 - 它给了我这个错误:
ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
at flash.display::DisplayObjectContainer/removeChild()
at CopterScratch/gameStart()
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at fl.controls::LabelButton/keyUpHandler()
这是我的代码:
public function gameStart(e:MouseEvent):void {
removeChild(objTitleScreen);
if (btnStart.enabled){
removeChild(btnStart);
}
removeChild(rbNormal);
removeChild(rbDifficult);
tmrMoveMap.start();
tmrGravity.start();
addChild(objHelicopter);
}