Another option is to have the images load externally.
voycieh's code will work for sure, but I think this'll end up being less work and will allow you to switch out any of the images without having to mess with the flash document itself.
You can set up a folder called "photos" with the jpgs saved into it.
Make sure that the photos are names with the pure number... i.e. "1.jpg, 2.jpg, 3.jpg... 15.jpg, 16.jpg, 17.jpg, etc." as opposed to having "01.jpg." 'cos that'll cause a little issue.
We're going to assume you have 20 images, cool?
Then you want to set up your timeline like this.
Wherever you want the images to load, insert an empty movieclip (you can call it "empty," how about that) with instance name "holder."
On frame one, in the actions layer, write:
Then make two buttons... in the actions of the forward button, put
on(release){gotoAndPlay("forward");}
and in the actions of the backward button, put
on(release){gotoAndPlay("backward");}
I'm assuming you've got your framerate set to 12 frames/second (pretty standard, I think).
Label frame two "forward" and make it 480 frames long (you know 40 seconds is an awfully long time). On the next frame (after the 480 frames of "forward"), put in a keyframe and label the section "backward"... make it 480 frames long as well.
On the first frame of the "forward" section, put the script
i++;
if(i>20){i=1;
loadMovie(i+".jpg", "holder");
}else{
loadMovie(i+".jpg", "holder");}
- i++;
- if(i>20){i=1;
- loadMovie(i+".jpg", "holder");
- }else{
- loadMovie(i+".jpg", "holder");}
On the first frame of the "backward" section, put the script
i--;
if(i<1){i=20;
loadMovie(i+".jpg", "holder");
}else{
loadMovie(i+".jpg", "holder");}
- i--;
- if(i<1){i=20;
- loadMovie(i+".jpg", "holder");
- }else{
- loadMovie(i+".jpg", "holder");}
On the last frame of BOTH the "forward" and "backward" sections, insert a keyframe with the action
What this is going to do is make it so that when you press the forward button, it cycles to the next "up" number image and when you press the backward button, it cycles to the next "down" number image. When you press nothing, it goes "up" after 40 seconds (a long, long time for someone like me with ADHD.)
The variable "i", which is initialized at the beginning (i=0), is the determinant of which image it's going to load.
I've also set if/else statements up so that, if, when moving forward, the number is greater than the number of images you've got, it'll cycle back down to image 1.jpg and if, when moving backward, the number drops below 1, it cycles back up to image 20.jpg.
If you've got a different number than 20 images, just change that 20 to whatever that number is.
peace out,
puck