all groups > flash actionscript > july 2004 >
You're in the

flash actionscript

group:

fast forward & rewind


Re: fast forward & rewind IwannaFlashU
7/16/2004 10:12:00 PM
flash actionscript:
Here's code that I just wrote today that works fine for my purposes:

on (press) {
here = _root.mc.q3movie._currentframe;
max = _root.mc.q3movie._totalframes;
jump = Math.round(max/_root.block);
if (here+jump<max){
_root.mc.q3movie.gotoAndPlay(here+jump);
}else{
_root.mc.q3movie.gotoAndPlay(max);
}
}

in my case, the movie being played is a couple of levels deep so that's why
there's the "_root.mc.q3movie." in front of the gotoandplay command.

that aside, you need to know where you're at (_currentframe) when the user
clicks the ff or rwd button. You then need to move the playhead by adding (fast
forward) or subtracting (rewind) and certain amount of frames to the current
position of the playhead.

The certain amount you choose is up to you. The variable "_root.block" above
is a percentage value that I define in the beginning of the project (10 for 10
percent) so I can adjust that if so desired. I then divide the length of the
movie (_totalframes) by that block value to come up with the amount I want to
move the playhead.

As you are adding or subtracting an amount to your current position, you need
to check if that math takes you beyond the timeline minimum and maximum and
adjust where you go if it does.

In summary, you need to know where you're at when the button is pressed, and
how far you want to go from that point, and then it's simply a case of
gotoandplay (plus or minus) where you're at.

hope this helps
fast forward & rewind ~x~
7/16/2004 10:22:55 PM
Hello,

I am working on flash video presentation and would like
to give users full control over the movie playback.

Play, pause and stop are no problem, but what about "fast forward" or
"rewind" playback controllers?

How do I code it?

If play is:

on (release) {
play();
}

how does fast forward or rewind look like?

Tnx!!

great ng!

Re: fast forward & rewind ~x~
7/17/2004 2:00:26 AM
[quoted text, click to view]

Tnx for your effort and time.
It is 2am here now, I will look at it tomorrow...

tnx again!

Re: fast forward & rewind ~X~
7/24/2004 12:48:23 AM
[quoted text, click to view]

on (release) {
here = _540;
max = _2709;
jump = (max/_20);
if (here+jump<max){
gotoAndPlay(here+jump);
}else{
gotoAndPlay(max);
}
}

it doesn't work.

I am quite green in flash coding, what is wrong with above
code, please?

AddThis Social Bookmark Button