flash spinner questoin
hey guys,
I'm looking to top off a little board game. So I've been looking for a spinner like the old twister style. Now in my search I found something that is close but works based upon how long you hold down the wheel. is there a way to make this function with a flick up instead of a mouse hold? here's the code I found,
import flash.display.*;
import flash.events.*;
import flash.utils.getTimer;
import fl.transitions.Tween;
import fl.transitions.TweenEvent;
import fl.transitions.easing.*;
var spinning:Boolean = false;
var spinTween:Tween;
var startTime:Number;
wheel.addEventListener(MouseEvent.MOUSE_DOWN, setStartTime);//longer you hold the harder you spin
wheel.addEventListener(MouseEvent.MOUSE_UP, spinWheel);
function setStartTime(e:MouseEvent) {
startTime = getTimer();
}
function spinWheel(e:MouseEvent) {
if (!spinning) {
spinning = true;
var spinTime = Math.min(12.2, Math.max(2.12, ((getTimer() - startTime) / 100)));
var endRot = Math.round((spinTime * 360) + (Math.random() * 360));
spinTween = new Tween(wheel, "rotation", Regular.easeOut, wheel.rotation, endRot, spinTime, true);
spinTween.addEventListener(TweenEvent.MOTION_FINISH, spinTween_finished);
}
}
function spinTween_finished(e:TweenEvent):void
{
spinning = false;
}