-
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
-
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]
-
Oops -- just made a minor change to make the initial spin speed random...