Hi all,

I'm having problems hittesting a variable. The function fire is activated with space. This starts my character shooting. I want to remove the bullet variable when it hittests whatever i choose. At the moment this is "box".

Presently, the hittest occurs every time space is pressed and not when the bullet hits the box. Based on that i'm thinking that it's where i'm placing the hittest and not the hittest code.

I've tried placing it in various parts of my entire code but then i don't get a hittest at all.

Can anybody help please? I'd really appreciate some advice.

thanks in advance

Code:
function fire(){
    if(reloaded){
        x=maze.getNextHighestDepth();
        var bullet:MovieClip=maze.attachMovie("shot", "shot"+x, x);
        bullet._x=_root.crosshair._x-maze._x;
        bullet._y=_root.crosshair._y-maze._y;
        randomNum=random(bulletOffset)-bulletOffset/2;
        bullet._rotation=crosshair._rotation+randomNum;
        bullet.xSpeed=Math.cos(Math.PI/180 * bullet._rotation)*bulletSpeed;
        bullet.ySpeed=Math.sin(Math.PI/180 * bullet._rotation)*bulletSpeed;
        bullet.life=0;
        for(i=x;i<(x+1);i++){
                if("shot"+i.hitTest(box)){
                    trace ("x ="+(x));
                    trace ("i ="+(i));
                    trace (bullet);
                    }
                }
        
        bullet.onEnterFrame=function(){
            
            this._x+=this.xSpeed;
            this._y+=this.ySpeed;
            this.life++;
            
            if(this.life>totalLife){
                this.removeMovieClip();
                this.unloadMovie();
                }            
                
            
                
        }

        reload();
    };
};

function reload(){
    reloaded=false;
    timer=setInterval(this, "Reloaded", reloadSpeed);
}
function Reloaded(){
    clearInterval(timer);
    reloaded=true
}