A Flash Developer Resource Site

Results 1 to 12 of 12

Thread: Wheel Rotation

  1. #1

    Wheel Rotation

    how do you rotate a wheel from fast then slowly stops?
    b3nch08

  2. #2
    The ActionScript Master Master64's Avatar
    Join Date
    Apr 2003
    Location
    Netherlands
    Posts
    654
    Hoi
    code:
    wheel.speed = 50;
    wheel.onEnterFrame = function() {
    this._rotation += wheel.speed;
    wheel.speed--;
    if (wheel.speed == 0) {
    delete this.onEnterFrame;
    }
    };



    Master64
    useing:XP,MX

    don't send me PM's because i never check it so if you what to contact me use Email

  3. #3
    thanks man! how about rotating the wheel again by using a button. what should be the script on the button?
    b3nch08

  4. #4
    The ActionScript Master Master64's Avatar
    Join Date
    Apr 2003
    Location
    Netherlands
    Posts
    654
    hoi

    don't under understand!
    code:

    wheel.speed = 50;
    button_btn.onPress = function() {
    _root.wheel._rotation += wheel.speed;
    _root.wheel.speed--;
    };




    Master64
    useing:XP,MX

    don't send me PM's because i never check it so if you what to contact me use Email

  5. #5
    didnt work, when i press the button, it should rotate like the one on the enterframe.. but it seems that it only rotates the wheel one by one while pressing..thanks again.. =) im newbie
    b3nch08

  6. #6
    it's like spinning a wheel/roulette.. click the button and let the wheel spin until it stops...
    b3nch08

  7. #7
    The ActionScript Master Master64's Avatar
    Join Date
    Apr 2003
    Location
    Netherlands
    Posts
    654
    ooh you what some thing like the
    code:

    wheel_mc.speed = 50;
    _root.rotation = function() {
    this._rotation += wheel_mc.speed;
    wheel_mc.speed--;
    if (wheel_mc.speed == 0) {
    delete this.onEnterFrame;
    }
    };
    button_btn.onPress = function() {
    wheel.onEnterFrame = _root.rotation
    }


    just make a button called button_btn
    and a movieClip wheel_mc


    Master64
    useing:XP,MX

    don't send me PM's because i never check it so if you what to contact me use Email

  8. #8
    a million thanks man!
    b3nch08

  9. #9
    Senior Member
    Join Date
    Sep 2000
    Location
    Brazil - São Paulo
    Posts
    257

    hhmmm

    Hi, if ur making a spinning wheel/roulette, i think u cant use only this script, cause it will allways stop at the same point...u need a ramdom action..

  10. #10
    Senior Member
    Join Date
    Sep 2000
    Location
    Brazil - São Paulo
    Posts
    257

    Maybe

    Maybe adding that to the original Master64 code, u can get a ramdom speed at press, if u want it

    ----------------------------------------------------

    wheel.speed = Math.round(Math.random()*30+ 50);
    _root.rotation = function() {
    this._rotation += wheel_mc.speed;
    wheel_mc.speed--;
    if (wheel_mc.speed == 0) {
    delete this.onEnterFrame;
    }
    };
    button_btn.onPress = function() {
    wheel.onEnterFrame = _root.rotation
    }

    ----------------------------------------------------

  11. #11
    The ActionScript Master Master64's Avatar
    Join Date
    Apr 2003
    Location
    Netherlands
    Posts
    654
    Hoi

    Your right but the wheel starts slowing down when the user clicks a button and unless the user can click at the same time ever time it is random!
    Master64
    useing:XP,MX

    don't send me PM's because i never check it so if you what to contact me use Email

  12. #12
    Senior Member
    Join Date
    Sep 2000
    Location
    Brazil - São Paulo
    Posts
    257
    Hmm thats true, i didnt look at that..i was thinking on a button that starts a Stoped wheel, that rotates and stops again....(didnt check all the code, soz about that)...cause i imagined like those roullets things

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