dcsimg
A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Rotating Help!

  1. #1
    Junior Member
    Join Date
    Jun 2009
    Posts
    17

    Unhappy Rotating Help!

    So i have a button that makes a dial rotate CW once clicked. Once it reaches the 180 degree mark, it stops. Then, I click another button which makes the dial decrease in a CCW direction. The IF statement I have tells that dial to stop at the 30 degree mark while rotating and then start going CW again. So, it goes CCW and once reaches 30 degrees it starts to go CW.

    The problem im having is that once it reaches the 30, it tries to go CW but since it was originally going CCW i start to get this vibration thing going on. Its trying to go both ways :P

    Im wondering is there a script to make the rotation stop then increase?

    My script:

    Gauge is the dial thats moving...

    Code:
    Air_Receiver_Drain_Valve_1.onPress = function() { 
        gotoAndPlay(2); 
        air_pressure_2._visible = true; 
        gauge.onEnterFrame = function() { 
            if (this._rotation == 30 && Auto_Select._visible == true && Air_Receiver_Drain_Valve_2._visible == true) { 
                _root.Spinning_Wheels_1._visible = true; 
                _root.Spinning_Wheels_2._visible = true; 
                _root.Spinning_Wheels_1_NotMoving._visible = false; 
                _root.Spinning_Wheels_2_NotMoving._visible = false; 
                this._rotation += 1; 
            } else { 
                this._rotation -= 1; 
            } 
        }; 
    };
    As i said the ELSE statement is decreasing it while it wants to increase.

    Any help would be great!

  2. #2
    Title? Am I King or something?
    Join Date
    Jul 2009
    Location
    Ponyville, Happytown on the continent Nowhereland
    Posts
    26
    It seems to me that you need to give the computer more reasons NOT to rotate CCW once it has finished rotation.

    You seem to have a NotMoving boolean inserted. I would try to edit that code, because the dial's NotMoving will always be true, whether or not it is rotating CCW.

    So basically, what I mean is that the code wants to rotate the dial CCW all the time, and when it rotates CW, it notices that it is no longer rotated fully CCW and tries to fix that.

    But hey, don't trust my advice too much. I'm not a programming whiz.

  3. #3
    Title? Am I King or something?
    Join Date
    Jul 2009
    Location
    Ponyville, Happytown on the continent Nowhereland
    Posts
    26
    Sorry. I meant the dial's NotMoving will always be FALSE, not TRUE.

  4. #4
    Junior Member
    Join Date
    Jun 2009
    Posts
    17
    thanks for your reply

    i got it working

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