Hi guys needing some help here. Basically i want to advance to frame 4 after (guy1) hits the hitTestObject (home1_mc).
This is the error i get:
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()
And this is my code:
function exitFrameHandler(event:Event):void{
if(guy1.hitTestObject(home1_mc)) {
removeChild(guy1);
removeChild(guy2);
removeChild(guy3);
removeChild(o1);
removeChild(cherry1);
gotoAndStop(4);
}
}
the reason i have tried removing the child is due to them still being on screen after i switch menus for my game. any help is appreciated
Maybe you should also add in the handler:
removeEvetListener(EVENT_TYPE, exitFrameHandler);
If the listener is called twice you'll get that exact error - because the first time it removes the children and the second time you try to remove display objects which are no longer children of the container.