code:
// These 3 functions set the desired
// angle for each arrow (dividing 360
// into 3 slices) when you click on the arrow
recycle_mc.arrowA.onPress = function()
{
recycle_mc.desiredAngle = 0;
}
recycle_mc.arrowB.onPress = function()
{
recycle_mc.desiredAngle = 240;
}
recycle_mc.arrowC.onPress = function()
{
recycle_mc.desiredAngle = 120;
}
// this function keeps the wheel spinning
// until the desired arrow is on top
recycle_mc.onEnterFrame = function()
{
// set desiredAngle to next 'slot' which
// is higher than current _rotation, so that
// we always rotate clockwise
while (this.desiredAngle < this._rotation)
{
this.desiredAngle += 360;
}
// Insure we don't over-rotate
while (this.desiredAngle > this._rotation+360)
{
this.desiredAngle -= 360;
}
var da = this.desiredAngle - this._rotation;
this._rotation += da * .1;
// use higher numbers (.2 .3 etc.)
// for faster speeds
}
// this initializes the wheel
recycle_mc.desiredAngle = 0;