Ok so I was looking for a nice tutorial on scrubbing through a video by mousing down over it and dragging through the frames but it couldn't actually find any (not a scrub bar where the flv loads).....
But I've managed to get a hold of this AS2 code for what I'm trying to do. Now I know nothing about AS2 but I can sort of work out for myself whats going on here. But I cant translate it to AS3. Can someone please help me write this out in AS3 syntax/format
I tried this just off the top of my head but its way off...probably will make things worse trying to work off itPHP Code:onMouseDown = function() { //when the mouse is clicked
mouseLocV = _xmouse; // mouseLoc = x co-ordinates of the mouse at time of clicking
imgMC.onEnterFrame = function() { //initiate a constant checking of the mouse x location
differenceV = _xmouse - mouseLocV; //finds the difference between the current mouse location and the previous location
differenceV = differenceV / 10; //***makes the movieclip advance 1 frame for every 10 pixels the mouse moved
gotoFrameV = (imgMC._currentframe + differenceV) % imgMC.totalFrames; //finds the remainder the use for which frame to go to
imgMC.gotoAndStop(gotoFrameV); //stops the movieclip at the frame specified
mouseLocV = _xmouse; // mouseLoc = the new x co-ordinates of the mouse
}
}
onMouseUp = function() { //when the mouse button is released
delete imgMC.onEnterFrame; //stop checking mouse position
}
PHP Code:stage.addEventListener(MouseEvent.MOUSE_DOWN, scrub);
stage.addEventListener(MouseEvent.MOUSE_UP, stopScrub);
video.addEventListener(Event.ENTER_FRAME, diff);
function scrub (event:MouseEvent):void {
var mouseLocation = mouseX;
function diff (e:Event):void {
var difference = mouseX - mouseLocation
difference = difference /10;
var goToFrame = (video.currentFrame + difference) % video.totalFrames;
video.gotoAndStop(goToFrame);
mouseLocation = mouseX
}
}
function stopScrub (event:MouseEvent):void {
delete video.ENTER_FRAME;
}
onMouseUp = function() {
delete imgMC.onEnterFrame;
}


Reply With Quote