A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: [Resolved] [Resolved] [Resolved] [Resolved] [Resolved] [Resolved] [Resolved] [Resolved] [Resolved] [

  1. #1
    Senior Member
    Join Date
    Aug 2000
    Posts
    473
    right what it is, i have a circle split into difrent coloured sections with an arrow in the middle....when i click a button i want the arrow to spin and then slow down and randomly stop at a colourd section...

    whats the easiest way to do this..??

    thanks

  2. #2
    Senior Member
    Join Date
    Jul 2000
    Location
    Not on the dole any more
    Posts
    1,040
    First, in your button (this assumes that your arrow has the instance name 'arrow'):

    Code:
    on (release) {
        if (!_root.arrow.spinning) {
            _root.arrow.spinning = 1;
            _root.arrow.speed = (math.random()*20)+30;
        }
    }
    Now in the Object actions of your 'arrow' movie clip:

    Code:
    onClipEvent (load) {
        friction = 1.1;
        rot = 0;
    }
    onClipEvent (enterFrame) {
        if (spinning) {
            rot += speed;
            this._rotation = rot;
            speed /= friction;
            if (speed <= .1 && spinning) {
                spinning = 0;
    // *** Your actions for when the arrow stops spinning go here ***
            }
        }
    }
    You can fiddle with the 'speed' and 'friction' values to change how fast it starts rotating and how quickly it slows down.

    [Edited by Stickman on 07-05-2001 at 09:16 AM]

  3. #3
    Senior Member
    Join Date
    Jul 2000
    Location
    Not on the dole any more
    Posts
    1,040
    Oops -- just made a minor change to make the initial spin speed random...

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