Can't make movie clip rotate with mouse

I’m working on a tank game for my Flash class that has a cannon that’s supposed to rotate with the mouse. Unfortunately I can’t get the rotation to work properly.

Firstly the cannon does not follow the mouse in full 360 degrees and does this weird rubberbanding “bounce” back to a previous position. Secondly when it does follow it does so in the opposite direction in which the mouse is moved.

The cannon is a movie clip and nothing is put on the stage (this is done by the code itself). Everything is located in the library and all the coding is done through AS files.

My experience with coding in flash is minimal, the past couple of weeks being my first exposure to it, just to give you an idea where I stand. Below is the code for cannon.

package
{
import flash.display.MovieClip;
import flash.events.Event;
import flash.events.MouseEvent;

public class Cannon extends MovieClip
{
    
    private var angle:Number; //holds the angle that will be used for the balls rotation
    //private var radians:Number; //holds the angle (in radians) that will be calculated using trigonometry
    private var dX:Number; //holds the distance between the turret and mouse horizontally
    private var dY:Number; //holds the distance between the turret and mouse vertically

    public function Cannon():void
    {
        init();
    }

    private function init():void
    {
        

        addEventListener(Event.ENTER_FRAME, onEnterFrame);
        
    }
    
    
    
    // following mouse errors located here
    // look for different rotation math
    private function onEnterFrame(event:Event):void
    {
        
        dX = mouseX - x;
        dY = (mouseY - y) * -1;
        //radians = Math.atan2(dY, dX);
        angle = Math.atan(dY/dX)/(Math.PI/180);
        //angle = radians * 180 / Math.PI;
        
        
        if (dX<0) {
            angle += 180;
        }
        
        if (dX>=0 && dY<0) {
        angle += 360;
        }
        rotation = (angle*-1) + 90;


        
}

}
}