# Rotating circle by mouse

**URL:** <https://forum.kirupa.com/t/rotating-circle-by-mouse/304040>\
**Category:** flash\
**Created:** [January 31, 2010, 5:18pm UTC](https://forum.kirupa.com/t/rotating-circle-by-mouse/304040 "2010-01-31T17:18:22Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![GrayFox](https://avatars.discourse-cdn.com/v4/letter/g/ecccb3/32.png) [@GrayFox](https://forum.kirupa.com/u/GrayFox)\
**Post date:** [January 31, 2010, 5:18pm UTC](https://forum.kirupa.com/t/rotating-circle-by-mouse/304040/1 "2010-01-31T17:18:22Z")

</div>

First, I am sorry if I posted this in the wrong section.

I have been working on this and thinking about it for days but I just can’t seem to get it right. I want to have a circle that I can “pick up” with the mouse and then rotate (with the rotation point in the center). Currently I have done this with the following code:

```php

 var radians = Math.atan2(mouseY-circle.y, mouseX-circle.x);
 var degrees = Math.round((radians*180/Math.PI));
  circle.rotation = degrees + 90;

```

I have added a mouse listener for movement to the circle mc and then checked if a button was down. On button down this code would be executed on enter frame. This code works but the main problem is that I want to be able to “pick the circle up” at any angle and rotate it. If I pick it up with this code the circle automatically rotates to 90 degrees. Does anyone have an idea on how to do this?
