dcsimg
A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: please help with simple rotation problem

  1. #1
    Junior Member
    Join Date
    Jan 2001
    Posts
    2
    I have a knob that I am trying to get to rotate as long as the mouse button is held down and the mouse is over the button. While the knob is rotating I will also eventually want to move a MC certain amounts.

    So far I'm having trouble just getting the knob to rotate right. I have this code in place:

    on (press) {
    knob._rotation=knob._rotation+2;
    }


    and it works okay, but you have to click every time you want any rotation. What code would I use if I want to be able to have the knob rotate constantly so long as the mouse is down?

    Oh and I know the x and y coords of the button this is attached to. They are:
    upper left: (270,6) upper right (311,6); lower left (270,86) and lower right (311,86).

    Any help would be greatly appreciated.

  2. #2
    Member
    Join Date
    Oct 2000
    Posts
    53
    try this..
    in my example i made a MC clip named knob..
    put it on the scene, give it the instance name 'knob' --> right click it --> choose actions
    enter the following code:

    Code:
    onClipEvent (enterFrame) {
    	if (_root.flag) {
    		_root.knob._rotation = _root.knob._rotation+2;
    	}
    }
    now make a sample button and add the following code:

    Code:
    on (press) {
    	flag = true;
    }
    
    on (release) {
    	flag = false;
    }
    When you run your project and press the button the MC rotates, when you release the button the MC stops rotating.. and so on and so on

  3. #3
    Junior Member
    Join Date
    Jan 2001
    Posts
    2
    Thanks for the help, it worked great!

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