Publishers of technology books, eBooks, and videos for creative people

Home > Articles > Design > Adobe Creative Suite

  • Print
  • + Share This
Like this article? We recommend

Like this article? We recommend

Adding Flash Playback Controls

One of the more compelling aspects of this technique is that a Flash track can be used to control playback in the QuickTime Player. Although QuickTime 4 is equipped only with Flash 3 Player, this still creates exciting possibilities for interactive Flash and video combinations, not the least of which is the capability to supplant the standard QuickTime controls with custom versions.

  1. To add the Play button, select the first frame of the Flash Controls layer. Open the Library, select the Play symbol from the Buttons folder, and then drag an instance of it onto the stage.

  2. Use the Info panel to reposition the Play button at the coordinates X: 241.7, Y: 135 (see Figure 5).

  3. Figure 5 Use the Info panel to position the Play button.

  4. With the Play button still selected, open the Actions panel and assign this code:

  5. on (release) {
      play ();
    }

    This is a fairly simple script. The on (release) handler captures any clicks on the Play button. When it does, play() causes the timeline to move forward, starting the video.

  6. From the Library, drag an instance of the Stop symbol onto the Flash Controls layer. Then use the Info panel to position it alongside Play at the coordinates X: 221.3, Y: 135.

  7. Open the Actions panel and insert this code:

  8. on (release) {
      stop ();
    }

    The QuickTime Player responds to Flash actions that are applied to the main timeline, so whenever the Stop button is clicked, playback ceases.

    For a viewer to return to the beginning of the video presentation and watch it again, he needs a Rewind button. Let's set up that button next.

  9. Drag an instance of Rewind from the Library to the Flash Controls layer, reposition it to X: 201, Y: 135, and use the Actions panel to apply the actions (see Figure 6).

  10. on (release) {
      gotoAndStop (1);
    }

    Figure 6 Position the Rewind button on the stage, and apply the code to it.

    The gotoAndStop() action is executed whenever the user clicks Rewind. gotoAndStop() causes the main timeline to return to frame 1, the number specified as its argument.

    NOTE

    In ActionScript, an argument refers to just about anything enclosed in parentheses. Arguments can be composed of text, numbers, or variable or object names, and they are used to influence the operation of a function or action.

    Finally, you must create the Toggle Subtitles button. Subtitles are traditionally limited to the world of cinema or television, but, using Flash and QuickTime, adding them to Web-based video is a straightforward job as well. This button will toggle the subtitle display on and off by controlling a movie clip that's to be added in the next section. (See Figure 7.)

    Figure 7 Notice the Subtitles button that toggles captions on and off.

  11. From the Library, drag an instance of Toggle Subtitles onto the stage, reposition it to X: 262.1, Y: 135, and use the Actions panel to assign the actions to the button (see Figure 8).

  12. on (release) {
      tellTarget ("Subtitles") {
        play ();
      }
    }

    Figure 8 Position the Toggle Subtitles button on the stage, and apply the specified code.

    When a visitor clicks the Toggle Subtitles button, the tellTarget() action is used to control the Subtitles movie clip instance.

    If you're new to Flash, you may not have encountered tellTarget() before. It's actually an older action that must be used in this situation because QuickTime 4 supports Flash 3 or lower. Flash 3's range of actions was much more limited than Flash 5's, so get ready for some vintage coding.

  • + Share This
  • 🔖 Save To Your Account