How can I code for a click and drag to progress forward/backward in timeline
I'm working on a project, the goal is to have a .swf animation like this.
The functionality I'm looking for is:
1. I need my animation to make one full rotation and stop,
and then
2. I need to fix my AS3 so you have to CLICK/HOLD/DRAG to progress forward and backward through the timeline, but only when your holding the mouse button down.
Currently the code progresses the frame forward and backward in relation to the mouseX position.
Here is my current code:
import flash.events.MouseEvent;
var startPosition:Number=mouseX;
var delayTime=10;
gotoAndStop(1);
stage.addEventListener(MouseEvent.MOUSE_MOVE, onMouse);
function onMouse(e:MouseEvent):void{
stage.removeEventListener(MouseEvent.MOUSE_MOVE,onMouse);
var currentPosition:Number=mouseX;
if(mouseX-startPosition<=0){
nextFrame();
}else{
prevFrame();
}
setTimeout(setListener, delayTime);
}
function setListener(){
startPosition=mouseX;
stage.addEventListener(MouseEvent.MOUSE_MOVE,onMouse);
}
any help would be appreciated,
Thanks.
