2014-05-06 48 views
0

嗨,大家需要一些帮助。基本上我想在(guy1)击中hitTestObject(home1_mc)后前进到第4帧。Flash AS3用hitTestObject前进到下一帧

这是错误我得到:

ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller. 
    at flash.display::DisplayObjectContainer/removeChild() 
    at DNAGames2_fla::MainTimeline/exitFrameHandler() 
ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller. 
    at flash.display::DisplayObjectContainer/removeChild() 
    at DNAGames2_fla::MainTimeline/exitFrameHandler() 

这是我的代码:

function exitFrameHandler(event:Event):void{ 
if(guy1.hitTestObject(home1_mc)) { 
     removeChild(guy1); 
     removeChild(guy2); 
     removeChild(guy3); 
     removeChild(o1); 
     removeChild(cherry1); 

     gotoAndStop(4);   
    }  
} 

我都试图消除孩子的原因是因为他们仍然在屏幕后,我切换菜单为我的游戏。任何帮助表示赞赏

回答

0

也许你还应该添加在处理程序:

removeEvetListener(EVENT_TYPE, exitFrameHandler); 

如果监听器被调用两次,你会得到确切的错误 - 因为第一次它消除了孩子们和第二次您尝试删除不再是容器子项的显示对象。

+0

谢谢,所有提前它,看看它是否工作。这是为了我几天前的表态,但不知道更多; l) – Rickysteven1990