# How to drag and drop around a fixed center axis?

**URL:** <https://forum.kirupa.com/t/how-to-drag-and-drop-around-a-fixed-center-axis/186190>\
**Category:** flash\
**Created:** [April 19, 2006, 5:01pm UTC](https://forum.kirupa.com/t/how-to-drag-and-drop-around-a-fixed-center-axis/186190 "2006-04-19T17:01:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jaimesilva](https://avatars.discourse-cdn.com/v4/letter/j/91b2a8/32.png) [@jaimesilva](https://forum.kirupa.com/u/jaimesilva)\
**Post date:** [April 19, 2006, 5:01pm UTC](https://forum.kirupa.com/t/how-to-drag-and-drop-around-a-fixed-center-axis/186190/1 "2006-04-19T17:01:10Z")

</div>

Hi.

I nedd to build a “See if you have the right weight” wheel in Flash.  
It have to be a small wheel over a bigger one. The top one have to be drag and drop like it was pined to the other one, so it rotates around the center axis (when click and drag with the mouse over), allowing us to match the scales in the wheels as we like.

I’ve found a lot of tuturials about drag and drop objects in Flash, but freely, not around a fixed center axis.

Anyone could help me, please?  
I’m really in a hurry to complete this project.

Thank you

---

<div class="post-metadata">

**Author:** ![jaimesilva](https://avatars.discourse-cdn.com/v4/letter/j/91b2a8/32.png) [@jaimesilva](https://forum.kirupa.com/u/jaimesilva)\
**Post date:** [April 21, 2006, 11:45am UTC](https://forum.kirupa.com/t/how-to-drag-and-drop-around-a-fixed-center-axis/186190/2 "2006-04-21T11:45:29Z")

</div>

I managed to get the effect I wanted with this code:

myDial\_mc.onPress = function() {  
pressing = true;  
};  
myDial\_mc.onRelease = myDial\_mc.onReleaseOutside=function () {  
pressing = false;  
};  
\_root.onEnterFrame = function() {  
if (pressing == true) {  
myRadians = Math.atan2((\_ymouse-myDial\_mc.\_y), (\_xmouse-myDial\_mc.\_x));  
myDegrees = Math.round(myRadians\*180/Math.PI);  
myDisplay\_txt.text = myDegrees+" degrees";  
myDial\_mc.\_rotation = myDegrees+90;  
}  
};

myDial\_mc is the instance name of the moviclip containing the object you want to rotate.
