Hi everyone,
Yes, I need to use you guys as a sounding board once more :-)
I have a button that has two listeners one for mouse up and the other for mouse down and they point to the same function.
-
$btnRewind.addEventListener(MouseEvent.MOUSE_DOWN,onBtnBack);
-
$btnRewind.addEventListener(MouseEvent.MOUSE_UP,onBtnBack);
-
I want the end user to keep holding down their mouse to rewind and when they release the mouse, then I want the while loop to break.
As you can see by the code below, I've been trying a ton of stuff and I've commented out all the stuff that I'm not currently using
-
private function onBtnBack(event:MouseEvent) : void
-
{
-
myCurrentPlayHead = Number($video.time);
-
//trace("$video.timecode "+$video.timecode);
-
//trace("$video.time "+$video.time);
-
//trace("event "+event);
-
//trace("myCurrentPlayHead "+myCurrentPlayHead);
-
//myConvertTime = String($video.timecode);
-
//myConvertTimeArray = myConvertTime.split(/:/);
-
//myCounterSec = Number(myConvertTimeArray[2]);
-
//myCounterFrames = Number(myConvertTimeArray[3]);
-
//myActualSeconds = myCounterSec * $video.fps;
-
//myActualFrames = myActualSeconds + myCounterFrames;
-
//trace("myActualFrames "+myActualFrames);
-
//myEndTime = Number($video.stream_end_time);
-
//trace("myEndTime "+myEndTime);
-
-
-
while(myCurrentPlayHead>0 && event.type == "mouseDown")
-
{
-
if(event.type == "mouseUp")
-
{
-
break;
-
}
-
else
-
{
-
myCurrentPlayHead = myCurrentPlayHead - 0.05;
-
trace("myCurrentPlayHead rwnd "+myCurrentPlayHead);
-
my_timedProcess = setTimeout(my_rewindFunction,1000/$video.fps);
-
}
-
}
-
-
}
-
-
public function my_rewindFunction():void
-
{
-
if(myCurrentPlayHead > 0)
-
{
-
$video.pause();
-
$video.seek(myCurrentPlayHead);
-
}
-
}
-
Within the while loop, I have an if statement that basically checks for a mouseUp event, but it's like the function has already passed the event.type == "mouseDown" to the while loop, which means that the event.type == "mouseUp" will not arrive until the while loop has completed it's infinite loop.
BTW, speaking of infinite loops, I am tracing the var myCurrentPlayHead and it always goes below 0 into negative numbers, but the while loop still doesn't break.
Please help, I'm at a loss -- this should work.
Thanx n advance