5 Replies Latest reply on Jan 31, 2007 8:32 AM by Horea4

    Help with Buttons

      So here is my problem:
      I have a button which I want to rotate an image. It rotates it with a value of 2 every time the button is clicked on. Needless to say, if you want to turn it 90 degrees, you'll have to press the button an annoying number of times. So I'd like to be able to rotate the image if the user click and holds the button down, without having to click over and over again.
      I hope you understand my problem.
      Now, how the hell can I do that???
      Caus I'm getting pretty nervous here.

        • 1. Re: Help with Buttons
          Jan-Paul K. Level 1
          You can use some kind of flag to check if the image should turn or not.
          So there should be a function that is running called by setInterval or by onEnterFrame Event that turns the image by a certain amount of degress evertime it is called and only when the flag is set.

          This is what the function could look like:

          function turnImage(){
          _root.image_mc._rotation = _root.image_mc._rotation+5;


          you can use the button to set a turn-flag like this:

          _root.turnFlag = true;
          on(release, releaseOutside, dragOut){
          _root.turnFlag = false;
          • 2. Re: Help with Buttons
            MotionMaker Level 1
            For the on(press). Call a function that will rotate + the last position. Use setInterval to fire the function or assign function to the onEnterFrame method on a MovieClip.

            For the on(release,releaseOutside). Use clearInterval if you are using the setInterval or assign the onEnterFrame method to undefined.
            • 3. Re: Help with Buttons
              sergiourra Level 1
              One way:

              a) the script of the button:


              b) The script of the MC with the image:


              You must refine it for backwad rotation on mouse release or for a max degrees rotation on press: It's your time...
              • 4. Re: Help with Buttons
                Jan-Paul K. Level 1
                ok, this one should be solved :-)
                • 5. Re: Help with Buttons
                  Level 1
                  Thanks a lot for your help.
                  Fixed it!