[FLASH8]Firing bullets from a rotating spaceship

Hey, all!

I’m making an asteroids-esque type game and need to make it so when you press the spacebar bullets come out from the tip of the spaceship. Can someone please explain to me why this code doesn’t work? Another thing-syntax was correct last time I checked.

keyListener = new Object();
Key.addListener(keyListener);
keylistener.onKeyDown = function() {
    if (Key.isDown(Key.SPACE)) {
    shipFire();
    }
};
var i;
function shipFire() {
    i++;
    var newname = "bullet"+i;
    var bulletSpeed = 20;
    _root.attachMovie("bullet", newname, i);
    _root[newname]._x = _root.total._x;
    _root[newname]._y = _root.total._y;
    _root[newname].onEnterFrame = function() {
        this._x += bulletSpeed*Math.sin(player._rotation*(Math.PI/180));
        this._y -= bulletSpeed*Math.cos(player._rotation*(Math.PI/180));
    };
};

PS- This is the part of the code where I have the firing function
The problem is the if(Key.isDown(Key.SPACE)) { part of the code. I know this because I did this:

keyListener = new Object();
Key.addListener(keyListener);
keylistener.onKeyDown = function() {
    if (Key.isDown(Key.SPACE)) {
    shipFire();
    trace ("commencing shipFire");
    }
};

and nothing was traced when I pressed the spacebar. Did I do something stupid (which is often the problem for me) or is there a bigger problem? One more thing-- I know this has been done billions of times in those more-than-common rotating turret & tank games so if you have the .fla for one of those maybe you could compare mine with yours.

Thank you!!:thumb2:

–Dragonist