Groups | Blog | Home
all groups > flash actionscript > november 2005 >

flash actionscript : Easy Playback Control



stephaniebryan
11/9/2005 11:58:49 PM
I have a very simple project, but am unable to solve a simple problem. The file
was originally created in Captivate, but I moved it to Flash so I could have
more control over the motion. I didn't create the playback images I wanted in
Captivate because it should be simple to create them directly into Flash and
then transfer the Actionscript from the Captivate playback. Or so I thought.
The Play, Pause are done (even I could figure those out). But I need more from
my Rewind and Forward buttons than just frame by frame. I need them to move to
the last relevant place in the movie (btw, this is an instructional video for a
website), from anywhere in the movie. I realize this has something to do with
labels and variables, but I have not discovered the very simple way to do this.
In all my research, I have found many complicated was to apply this
functionality to sound and video, but not to just a simple timeline.

At the very least, I would appreciate being pointed towards a useful tutorial
with regards to this situation.

Thank you!
Chip W.
11/10/2005 12:23:49 AM
hey Stephanie,

For a rewind button, you can use:

on (press) {
gotoAndStop(_currentframe-1);
}

and then, obviously, for a forward button, just replace the - with a +;

on (press) {
gotoAndStop(_currentframe+1);
}

That will step thru the frames. If you want buttons that continuously rewinds
of fast forwards without having to keep pressing the buttons, you can
incorporate that code into several different methods, the easiest being a
looping movie clip that continuously fires off the rewind of fast forward code
when rw or fw buttons are being held down. Create a 2 frame movie clip and put
this code on frame 1:

if (_root.rw == 1) {
_root.gotoAndPlay(_root._currentframe - 1);
}else if(_root.rw == 0) {
_root.stop();
}

if (_root.fw == 1) {
_root.gotoAndPlay(_root._currentframe + 1);
}else if(_root.fw == 0) {
_root.stop();
}


On your rewind button, add this code:

on (press) {
rw = 1;
}
on (release, releaseOutside, rollOut, dragOut) {
rw = 0;
}

on your fast forward button, add this code:

on (press) {
fw = 1;
}
on (release, releaseOutside, rollOut, dragOut) {
fw = 0;
}

Again, that's the most basic method, but it works.

~Chipley
stephaniebryan
11/10/2005 12:46:12 AM
Thank you so much for responding! But unfortuneatly I don't want a continuous
rewind. I'm searching for a way to use designated places to "rewind" or
"fast-forward" to. It's more like skipping to the next section or returning to
the previous section. Isn't there a way to do it all on one timeline without
creating a movie clip? I found some code to use but I'm positive it's more
complicated than necessary-- besides, it didn't work anyway.

Thanks!
Chip W.
11/10/2005 1:03:59 AM
Ah, my bad. You need a label navigation system. You'll need to add frame labels
to every frame you want to go back or forward to.

Select a keyframe which is the point you wish to begin, and go to
Properties>Frame, or if the Properties dialog is not showing,
Windows>Properties>Frame. In the properties dialog, click inside the frame
input box and give your frame a frame label. i.e. - "yourFrame". On your
button, add this code,

on (release){
gotoAndStop("yourFrame");
}

For multiple frames, you can add different actions to the same button. Just
keyframe the button and change the "gotoAndStop("yourFrame");" code to reflect
the next frame you wish skip to.

I take it that's what you're after?
~Chipley
AddThis Social Bookmark Button