Deleting an attached MC var?

I have a vertical shooter game. My problem is that the enemies (randomly duplicated with _root.attachMovie) need to delete after being hit by bullets (" "). I stand in variables like st = something + i, with i increasing after each execution. For some reason, when I run debug, the numbers jump around (1,7,25,69,122), and I can’t adress the hitTest. Could anyone help? If you need it, I can send you the whole game and you can alter the AS. My email is esoltas@gmail.com. Here’s the code:
mouseListener = new Object();
Mouse.addListener(mouseListener);
function moveHero(speed) {
//check if key is down
if (Key.isDown(Key.LEFT)) {
_root.hero._x -= speed;
} else if (Key.isDown(Key.RIGHT)) {
_root.hero._x += speed;
}
mouseListener.onMouseDown = function() {
fireBullets();
};
}
var i;
function fireBullets() {
i++;
var newname = “bullet”+i;
_root.attachMovie(“bullet”, newname, i);
_root[newname]._y = _root.hero._y-100;
_root[newname]._x = _root.hero._x;
_root[newname].onEnterFrame = function() {
var bullet_speed = 4;
var alpha_decrease = 3;
this._y -= bullet_speed;
this._alpha -= alpha_decrease;
this._yscale -= alpha_decrease;
this._xscale -= alpha_decrease;
if (this._y<-22) {
this.removeMovieClip();
}
};
}
a = 0;
setting = 1;
onEnterFrame = function () {
a += 1;
moveHero(5);
if (random(50) == 0) {
setting += 1;
var enemy:MovieClip = attachMovie(“enemy”, “enemy”+a, a);
enemy._x = Stage.width+enemy._width;
enemy._y = random(145);
enemy.gotoAndStop(setting);
enemy.speed = (Math.random()*10)+2;
enemy.onEnterFrame = function() {
this._x -= enemy.speed;
if (this._x<-100) {
this.removeMovieClip();
}
if (setting>10) {
setting = 0;
}
};
}
};