# AS2 \> Clock hands movement

**URL:** <https://forum.kirupa.com/t/as2-clock-hands-movement/330284>\
**Category:** flash\
**Created:** [December 25, 2012, 3:04am UTC](https://forum.kirupa.com/t/as2-clock-hands-movement/330284 "2012-12-25T03:04:58Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![hsiehson](https://avatars.discourse-cdn.com/v4/letter/h/9f8e36/32.png) [@hsiehson](https://forum.kirupa.com/u/hsiehson)\
**Post date:** [December 25, 2012, 3:04am UTC](https://forum.kirupa.com/t/as2-clock-hands-movement/330284/1 "2012-12-25T03:04:58Z")

</div>

Hi all,

I’m creating a teaching material that teaches children learn to read the time. I currently have a clock with both hour and minute hands draggable independently, but WHAT IF I want the hour-hand to move (ie. rotate) according to the movement of the minute-hand, just like how we adjust the clock in reality by moving (ie. dragging in this case) the minute-hand?

Many Thanks!

The code that I have got so far as follows;

```auto

mcMinute.onPress = function() {
  this.onMouseMove = function() {
    var angle:Number = Math.atan2(
      mcFace._ymouse - mcFace._height / 50,
      mcFace._xmouse - mcFace._width / 50
    );
    this._rotation = (angle * 180 / Math.PI) +90;
  };
};
mcMinute.onRelease = function() {
  delete this.onMouseMove;
};
mcMinute.onReleaseOutside = mcMinute.onRelease;

mcHour.onPress = function() {
  this.onMouseMove = function() {
    var angle:Number = Math.atan2(
      mcFace._ymouse - mcFace._height / 50,
      mcFace._xmouse - mcFace._width / 50
    );
    this._rotation = (angle * 180 / Math.PI) +90;
  };
};
mcHour.onRelease = function() {
  delete this.onMouseMove;
};
mcHour.onReleaseOutside = mcHour.onRelease;

```
