Here’s a few ideas to get you started.

If you draw the wheel in Flash, and center it around the cross-hairs in the editor, then in actionscript you can rotate it. Let’s say your wheel movie is called wheel_mc.

```
wheel_mc._rotation = wheel_mc._rotation + spinSpeed;
```

This spins the wheel, but what should you set spinSpeed to?

We’d like to to start fast, then slow down over time.

One half of a cosine wave might fit the bill for controlling this kind

of deceleration. Let’s say “spinDuration” is set to the amount of time

you want the spinning to last (10 seconds or so) and “startOfSpin” is set to

the value of “getTimer().001” (or the current time in seconds) at the time the

wheel starts spinning…

```
wheel_mc.onEnterFrame = function()
{
// get the elapsed time since the start of the spin
elapsedTime = getTimer()*.001 - startOfSpin;
// convert it to a number from 0-1
elapsedTime /= spinDuration;
if (elapsedTime > 1) {
// we're done spinning - see below for an example of what to do here...
spinSpeed = 0;
this.onEnterFrame = 0;
}
else {
// Math.cos over the range from 0 thru PI will produce a sine-wave
// curve starting at 1 and going down to -1. This may be a good
// approximation of the wheel deceleration.
spinSpeed = 15 + Math.cos(Math.PI * elapsedTime)*15;
}
this._rotation = this._rotation + spinSpeed;
}
```

Over the course of “spinDuration” (whatever you set that to), the spinSpeed will slow down from 30 to 0. Note: If you find your wheel is going backwards, invert the cosine wave by using -Math.cos().

When elapsedTime reaches spinDuration, then you can stop spinning the wheel and figure out what number you’re at, by looking at the current value of wheel_mc._rotation.

```
curPos = wheel_mc._rotation/360;
curPos -= Math.floor(curPos); // this gets it to 0-1
// let's say all your numbers are stored in an array from 0 - n-1
curChoice = myArray[Math.floor(curPos*n)];
// now you know your current choice... what are you going to do with it?
```

As you can see, converting numbers to a 0-1 range is very useful for converting from one kind of data to another. Numbers in this form are called “normalized”, and they are a very powerful tool for programmers.

In this example, I used normalization to convert from the spin-time to the position on the cos wave that I wanted to exploit, and also to convert from wheel position (0-360) to an array lookup for your wheel wedge scores.