# Need help with maths

**URL:** <https://forum.kirupa.com/t/need-help-with-maths/320037>\
**Category:** flash\
**Created:** [March 12, 2011, 1:30am UTC](https://forum.kirupa.com/t/need-help-with-maths/320037 "2011-03-12T01:30:11Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![danieldmm](https://avatars.discourse-cdn.com/v4/letter/d/cdc98d/32.png) [@danieldmm](https://forum.kirupa.com/u/danieldmm)\
**Post date:** [March 12, 2011, 1:30am UTC](https://forum.kirupa.com/t/need-help-with-maths/320037/1 "2011-03-12T01:30:11Z")

</div>

```auto
knob_mc.addEventListener(MouseEvent.MOUSE_DOWN,turn);
stage.addEventListener(MouseEvent.MOUSE_UP,endTurn );

function turn(e:Event):void
{
    stage.addEventListener(MouseEvent.MOUSE_MOVE,turn);
    var position:Number = Math.atan2(mouseY - knob_mc.y,mouseX - knob_mc.x);
    trace(position);
    var angle: Number=(position/Math.PI) *180;
    trace(angle);
    knob_mc.rotation = angle;
}

function endTurn(e:MouseEvent):void
{
    knob_mc.removeEventListener(MouseEvent.MOUSE_DOWN, turn);
    stage.removeEventListener(MouseEvent.MOUSE_MOVE,turn);
    knob_mc.addEventListener(MouseEvent.MOUSE_DOWN,turn);
}

```

This is the code I’m using to move a knob the challenge is when i click on the knob it turns 90 either left or right depending where i click, I’d like it to stay still until I turn the knob, and second how do I get the angle in whole numbers??
