Shooter problems, help!

Hey guys, i’ve got an annoying little problem. I am trying to make a game where you can walk with a MC and rotate the arm with a gun and shoot. The rotating works fine outside of a MC but when I place it inside a MC it’s screwed up!:S Can anyone help me?

Actions from the gun:

onClipEvent (mouseMove) {
Xd =_root._xmouse-_x; //Get _x distance from gun to mouse
Yd =_root._ymouse-_y; //Get _y distance from gun to mouse
radAngle = Math.atan2(Yd, Xd); //Use atan2 to calculate the angle from gun to mouse
_rotation = int((radAngle360 / (2Math.PI))+90); //Use PI to calculate and set gun rotation
updateAfterEvent();
}

Actions from the bullet:

onClipEvent(load){
spd=20; //bullet speed
_x=_root.gun._x; //Move to gun _x
_y=_root.gun._y; //Move to gun _y
_rotation= _root.gun._rotation; //Point in same direction as gun
}
onClipEvent(enterFrame){
if(_name == “bullet”){
_x = -1000; //Move the original bullet MC offstage
}else{
//Run this movement code on all dupes
if (_rotation>180) {
_y += (spdMath.cos( Math.PI/180_rotation));
_x -= (spdMath.sin( Math.PI/180_rotation));
} else {
_y -= (spdMath.cos (Math.PI/180_rotation));
_x += (spdMath.sin( Math.PI/180_rotation));
}
}
if(_x>Stage.width || _x<0 || _y<0 || _y>Stage.height){
//If off-stage, delete the dupe to save CPU
this.removeMovieClip();
}

}

Actions on the first frame of the maintimeline:

var bc=1000; //bulletcount
_root.onMouseDown=function(){
bc++;
if(bc>1100){ bc=1000; } //Reset bulletcount
duplicateMovieClip(“bullet”, “b”+bc, bc); //Create dupe bullet
}

WHAT AM I DOING WRONG? AND HOW CAN I FIX THIS?!:puzzled:

This is Denvishes code from new grounds…
Many people had the same problem. I made a different code based on the _ymouse possition. So it only rotates to a 45 degree and a vertical angle. I’m having problems when i invert the characters _xscale the bullets change direction. Any tips on stopping this?