Tracking array index of an instance?

I’m trying to keep track of several movie clips with an array, but I’m running into some issues.

I’m making a shooter game that requires hitTesting a list of projectiles and removing the projectiles from the list when they leave the screen or hit stuff. I’ve got the projectiles being added to the stage with this:


        _root.playerbullets.push(bullet);
        bullet.num = _root.playerbullets.length-1;

and each bullet gets a prototype function to move it around and stuff, and then it includes this to remove it from the array:


_root.playerbullets.splice(this.num,1);

At first that appeared to work fine, but the bullets aren’t always removed in the order they were created, so when I remove one from the array in this manner, it shifts the index numbers for all the ones that came after it back one, thus making their “num” variable no longer correspond to their index number; so when they try to splice themselves, they end up splicing the wrong ones. (Like, if I removed [3], the bullet that was in [4] is now in [3], but it doesn’t know that, so it tries to splice [4], which now refers to whatever was in [5], and so on.)

What’s the correct way to handle this kind of situation? I feel like I must be missing something obvious, but I haven’t been able to figure out a solution.