here is my set up :
when health gets to 0 the view class sets it gameOver to true.
the parent(named application) hears this and wants to remove the child view.
i get the error:
ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
here’s the application class
private function init(e:Event = null):void
{
removeEventListener(Event.ADDED_TO_STAGE, init);
addEventListener(Event.ENTER_FRAME,enterFrameHandler);
addChild(_view);
}
private function enterFrameHandler(e:Event):void
{
if(_view.gameOver==true)
{
trace("gameOverFromApplication");
removeTheView();
}
_model.update();
_view.keyPollUpdate();
}
private function gameOverHandler():void
{
trace("gameOverHandler");
}
private function removeTheView():void
{
this.removeChild(_view);
}
i’m not understanding this