Home > Articles > Graphics & Web Design > Dreamweaver & Flash

  • Print
  • + Share This
This chapter is from the book

Task: Slideshow

A slideshow is a simple presentation where you have various screens, or slides, presented one after the other. This is similar to how a plain Flash movie would work, except that without scripts, the movie would continue rather quickly through these frames.

Instead, we'll use scripts to pause the movie on each frame. To continue it, we will use buttons that allow the user to advance to the next frame whenever she wants.

  1. Create a new Flash movie. Place four different pieces of text or graphic on the first four frames. The example movie 05slideshow.fla contains the words "Frame 1" through "Frame 4" and a different shape on each frame.

  2. I've also placed the text "Slideshow Example" above everything else, stretched across all frames on its own layer. The result is partially shown in Figure 5.4. You can see the contents of Frame 1, plus the way the timeline is set up.

    Figure 5.4 The slideshow movie is set up with individual elements on each of the four frames plus some elements across all the frames.

  3. Create a button. It can be as simple or as complex a button as you want. In Figure 5.4, you can see my Next button at the bottom right.

  4. Make sure that the button is placed on a layer so that it stretches across all four frames of the movie. Check the example movie if you are not sure how this should look.

  5. Attach a script to the button. Make sure that you have the button and not the frame selected. The Actions panel should have the title Actions - Button at the top. Here is the script:

  6. on (release) {
      nextFrame();
    }
  7. Now, select the first frame of the movie. In Figure 5.4, you can see that one of the layers, Layer 1, has four separate key frames, and the other layer, Layer 2, has one key frame that stretches across all four frames. Select the first key frame in Layer 1 and open the Actions panel. Its title should now be Actions - Frame. Looking at the title of the script panel is a good way to confirm that you are writing a frame script, not attaching one to a movie clip. Place this simple script in the script panel:

  8. stop();

    This stops the movie from rapidly advancing from Frame 1 through Frame 4. We want it to stop at Frame 1 and await the user.

  9. Choose Control, Test Movie to see it in action. The movie starts at Frame 1 and then pauses. You can then click the Next button to advance to Frame 2. You can keep advancing until you get to Frame 4.

  10. The movie will not advance past Frame 4 because the nextFrame command will simply do nothing if there are no more frames. You could have placed the Next button in every frame except the last one so that the button will not even appear there.

Next, we'll build a much more complex presentation movie.

  • + Share This
  • 🔖 Save To Your Account