Hi everyone, i'm having a very simple problem, but I can't seem to fix it...
This is my destroyObjects function inside Actor....
And the way I call it is inside my Game....
removeActor calls the destroyObjects function...
And the problem I have is that only the Sprite associated with the Actor, but not the body...
Any Ideas??
Thanks!!
This is my destroyObjects function inside Actor....
Code:
public function destroyObjects():void
{
cleanBeforeRemove();
shape.parent.removeChild(shape);
PhysiVals.world.DestroyBody(body);
}
{
cleanBeforeRemove();
shape.parent.removeChild(shape);
PhysiVals.world.DestroyBody(body);
}
And the way I call it is inside my Game....
Code:
private function handleBallOffScreen(e:BallEvent):void
{
var ballToRemove:BallActor = BallActor(e.currentTarget);
ballToRemove.removeEventListener(BallEvent.BALL_OFF_SCREEN, handleBallOffScreen);
removeActor(ballToRemove);
}
{
var ballToRemove:BallActor = BallActor(e.currentTarget);
ballToRemove.removeEventListener(BallEvent.BALL_OFF_SCREEN, handleBallOffScreen);
removeActor(ballToRemove);
}
removeActor calls the destroyObjects function...
And the problem I have is that only the Sprite associated with the Actor, but not the body...
Any Ideas??
Thanks!!