PDA

View Full Version : im a 1000% NEwbie


screwface
06-25-2002, 04:08 PM
Ok im trying to set up a portfolio in flash with simple next and previous buttons.. i want to cycle forward/backwards through pictures utilizing this next and prev. button


any help

Esquared
06-25-2002, 04:52 PM
A fairly basic way to do this would be to place your pictures in the timeline one frame after the next. Then all you would have to do is create 2 buttons, which would be placed on every frame containing a picture. For a next button you would have:

on(release)
{
gotoAndStop(_currentframe + 1)
}

The previous button would have (_currentframe - 1) instead.

Then just omit the previous button from the first picture frame and the next button from the last one.

There are of course other ways of doing this in less frames, involving swapping of movie clips etc. but the way shown above is the simplest.

Hope it helps!

Esquared

Abelius
06-25-2002, 06:39 PM
1000 %...??? That's probably exxxxxagerated... LOL :)

screwface
06-25-2002, 07:29 PM
1st, thanks


Im trying to do what you said but it seem to be in a loop until i press the next button and it stops but doesnt go to the next pict..


Thanks

Esquared
06-26-2002, 01:52 AM
OK...So by a loop do you mean you're looping through all of your pics continuously when it starts? If this is the case, you need to put a stop(); action on the first frame of your movie.

As for not actually going to the next frame, the code I have does work. Be sure you have the underscore before the word currentframe: _currentframe

In case you need it, I'm also posting an exaple .fla. It should help you out.

lafatak
06-30-2002, 08:17 AM
Using a four frame movie as for an example....with a 'stop' action on each frame of your frame actions layer (assuming you have created one)....

On the forward button
// use the number of frames - 1 as your > number..

on (release) {
if (this._currentframe > 3) {
gotoAndStop(1);
} else {
nextFrame();
}
}

On the back button....
//use < frame 2 when cycling backwards to return you to the last
//frame..

on (release) {
if (this._currentframe < 2) {
gotoAndStop(4);
} else {
prevFrame();
}
}

HTH's....
Laf