A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: dragging a clock pendulum and rotating it manually

  1. #1
    Senior Member
    Join Date
    Mar 2002
    Posts
    160
    hello everybody,
    i have a problem here i need to let the user rotate the clock pendlum smoothly
    i made the pendulum a movieclip , and i put an invisible button over it which is dragged ,and i detect its position after dragging and then rotate the pendulum movie clip the problem is this doesnt go smoothly enough , it looks like the pendelum is jumping, do u have any different suggestions????
    THANKS IN ADVANCDE

  2. #2

  3. #3
    Senior Member
    Join Date
    Mar 2002
    Posts
    160

    THANKS A LOT , THIS IS EXACTLY WHAT I NEED

  4. #4
    Senior Member
    Join Date
    Mar 2002
    Posts
    160
    what if i need to have two rotating handles each rotating in quarter a circle ( i need it in a sound reflection simulation experiment i have tried to change restrictions but i failed
    here is the code , plz help
    code of 1st handle, it is in the fourth quadrant
    Code:
    
    onClipEvent (enterFrame) {
    		
                         if (rotate == true) {
    			f = getRotation();
    			n = _rotation+(f-rotation);
    			if (Math.abs(n)>165) {
    				_rotation = n;
    				rotation = f;
    			}
    		}
    		// 
    	//}
    }
    code of 2nd handle, it is in the third quadrant
    Code:
    
    onClipEvent (enterFrame) {
    	//if ((_xmouse<500 && _xmouse>160) && (_ymouse>90) && 
    //(_ymouse<240)) {
    		
    if (rotate == true) {
    			f = getRotation();
    			n = _rotation+(f-rotation);
    			if (Math.abs(n)>-165) {
    				_rotation = n;
    				rotation = f;
    			}
    		}
    		// 
    	//}
    }


    can i send u the fla ??



    [Edited by rasha ali on 08-30-2002 at 05:16 AM]

  5. #5
    ism BlinkOk's Avatar
    Join Date
    Aug 2001
    Location
    , location, location
    Posts
    5,002
    rasha ali,
    the Math.abs() method will remove the sign from the value so you should just check that the angle is within range ie.
    for the top left hand quarter;
    Code:
    if (n>-91 && n < 1)
    for the top righthand quarter;
    Code:
    if (n>-1 && n < 91)
    for the bottom left hand quarter;
    Code:
    if (n>-181 && n < -91)
    for the bottom righthand quarter;
    Code:
    if (n>89 && n < 181)

    here's an example of the top quarters;
    http://www.nlc.net.au/~oceana/games/mirrorGuage.swf
    http://www.nlc.net.au/~oceana/games/mirrorGuage.fla
    hope this helps
    BlinkOk

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center