I've put together some code to allow the user to rotate a clock hand around the clock by dragging it round. My code isn't working and I was wondering if anyone could take a look at it and see what I'm doing wrong.
Code:
onClipEvent (mouseDown) {
if (this.hitTest(_root._xmouse, _root._ymouse)) {
arrowDrag = true;
}
}
onClipEvent(mouseMove) {
if (arrowDrag == true) {
var coordy1 : Number = _ymouse - this._y;
var coordx1 : Number = _xmouse - this._x;
var angleRadians1 : Number = Math.atan2(coordy1,coordx1);
var angleDegrees1 : Number = angleRadians1 * 180 / Math.PI;
this.rotation = angleDegrees1;
}
}
onClipEvent(mouseUp) {
arrowDrag = false;
}
Anyone have any ideas? I have a feeling the code I used for the calculation of the mouse position and the rotation of the clock hand are in AS1 whereas the rest is AS2, perhaps. But I'm not sure to be honest because I've only ever had a basic grasp of AS2. Can anyone spot where I'm going wrong?