To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here


A Flash Developer Resource Site

Go Back   Flash Kit Community Forums > Flash Help > Flash ActionScript

Reply
 
Thread Tools Display Modes
Old 07-05-2001, 08:53 AM   #1
sweetdude_uk
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
sweetdude_uk is offline   Reply With Quote
Old 07-05-2001, 09:13 AM   #2
Stickman
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]
Stickman is offline   Reply With Quote
Old 07-05-2001, 09:17 AM   #3
Stickman
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...
Stickman is offline   Reply With Quote
Reply

Go Back   Flash Kit Community Forums > Flash Help > Flash ActionScript

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 08:25 PM.


internet.commerce
Be a Commerce Partner
 »  »  »  »  »  »  »
 »  »  »  »  »  »
 

    

Acceptable Use Policy

Internet.com
The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.