Alright so I did some research and got something working.
ActionScript Code:
move = function () {
this._x = _xmouse;
this._y = _ymouse;
var distance_x = stick._x-this._x;
var distance_y = stick._y-this._y;
var alpha = Math.atan2(distance_y, distance_x);
stick._x = this._x+Math.cos(alpha)*totalDistance;
stick._y = this._y+Math.sin(alpha)*totalDistance;
stick._rotation = (Math.PI+alpha)*180/Math.PI;
trace(stick._rotation);
};
press = function () {
this.onMouseMove = move;
};
release = function () {
delete this.onMouseMove;
};
var totalDistance = 170;
ball.onPress = press;
ball.onRelease = release;
ball.onReleaseOutside = release;
ball.move = move;
Now I'm trying to get the stick to rotate around the ball until it points down, but I'm having trouble making a loop to rotate properly around the ball.
I tried to make the rotation point the origin of the stick at 0,0 but then the totalDistance is 0 which screws up the move function rotation.