PDA

View Full Version : Sinf Pom..can you think of an easier way to do this?



I am not Jubba
April 9th, 2002, 11:47 PM
I have this animation. Click on the hand and then its spins around with the mouse, and then if you click again it lets go. I was wondering if there was an easier way that I missed

<embed src="http://www.angelfire.com/dc/vidgame/tutorials/MoveableHands.swf" height=250 width=250></embed>

here's the code on the hand..

onClipEvent (load) {
nStop = 0;
}
onClipEvent (enterFrame) {
nXmouse = _root._xmouse-_x;
nYmouse = _root._ymouse-_y;
Radius = Math.sqrt((nXmouse*nXmouse)+(nYmouse*nYmouse));
nAngle = Math.asin(nYmouse/Radius);
if (_root._xmouse<_x) {
nRadian = (-nAngle*180/Math.PI);
if (nDrag == true) {
_rotation = nRadian-90;
}
} else {
nRadian = (nAngle*180/Math.PI);
if (nDrag == true) {
_rotation = nRadian+90;
}
}
}
onClipEvent (mouseDown) {
if (hitTest(_root._xmouse, _root._ymouse)) {
nDrag = true;
}
}
onClipEvent (mouseUp) {
nStop++;
if (nStop == 2) {
nDrag = false;
nStop = 0;
}
}

sinfiniti
April 10th, 2002, 01:47 AM
try this:
jeremydecker.s5.com/click_point.swf (http://jeremydecker.s5.com/click_point.swf)
jeremydecker.s5.com/click_point.fla (http://jeremydecker.s5.com/click_point.fla)

fewer lines of code means less to debug!
:)
jeremy

I am not Jubba
April 10th, 2002, 06:44 AM
well jesus...i guess so....thanks sinf...

thoriphes
April 10th, 2002, 06:56 AM
edit the movieclip itself then move the bottom part of the hand to the crosshair in the middle. now when you do a _rotation script, it'll rotate around the bottom part of that hand. you don't really need all the math.