Question

I'm creating an asteroids game and in my main class I'm having some trouble handling the bullets that the ship fires.

All of the bullets are of the "Bullet" class and are stored in an array called "bullets" in the main class. When bullets exit the screen, removeBullet(bulletID) in the main class is called.

private function removeBullet(id:int)
    {
        removeChild(bullets[id]);
        bullets.splice(id);
    }

In my Bullet class I have an enterFrame listener that traces "stillHere". So as soon as a bullet is added to the main stage using addChild, "stillHere" starts popping up in my output panel.

My problem is that even after I call the removeBullet, "stillHere" keeps popping up in the output panel, which tells me that the object which I tried to delete is still sticking around somewhere in the memory.

What can I do to get rid of it completely?

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top