In my .fla file I have a movieclip A, which is a lever. It’s registration point is at one end and the user should be able to grab it with the mouse and spin it around it’s pivot point.
The best I could come up with so far is creating a second movieclip B and putting it inside A, at the opposite end from the pivot point. I also set the hitArea around this point.
I then use the following code to rotate it:
function findAngle(a:Number, b:Number, c:Number):Number {
return Math.acos((sqr(b) + sqr(c) - sqr(a)) /( 2 * b * c));
}
That’s only a workaround at best though, since I’d like the user to grab the lever at any point, not just at one end. Also, I’m not sure how to handle spinning in reverse on the above code, since arc cosine always gives a positive value.
Any ideas?