Controlling video playback using behaviors

Video behaviors provide one way to control video playback. Behaviors are prewritten ActionScript scripts that you add to an object, such as a video clip, to control that object. Behaviors allow you to add the power, control, and flexibility of ActionScript coding to your document without having to create the ActionScript code yourself. Video behaviors let you play, stop, pause, rewind, fast-forward, show, and hide a video clip.

To control a video clip with a behavior, you use the Behaviors panel to apply the behavior to a triggering object, such as a button. You specify the event that will trigger the behavior (such as releasing the button), select a target object (the video that will be affected by the behavior), and when necessary, select settings for the behavior, such as the number of frames to rewind.

The following behaviors are packaged with Flash MX 2004 and Flash MX Professional 2004 and are used to control embedded video.

Behavior

Purpose

Parameters

Play Video

Plays a video in the current document.

Instance name of target video

Stop Video

Stops the video.

Instance name of target video

Pause Video

Pauses the video.

Instance name of target video

Rewind Video

Rewinds the video by the number of frames specified.

Instance name of target video

Number of frames

Fast Forward Video

Fast-forwards the video by the number of frames specified.

Instance name of target video

Number of frames

Hide Video

Hides the video.

Instance name of target video

Show Video

Shows the video.

Instance name of target video

For lessons on working with video, select Help > How Do I > Quick Tasks > Create a Document or Import and Edit Video.

To add and configure a behavior:

  1. Select the object, such as a button, that will trigger the behavior.
  2. In the Behaviors panel (Window > Development Panels > Behaviors), click the Add (+) button and select the desired behavior from the Embedded Video submenu.
  3. In the dialog box that appears, select the video you want to control with the behavior.
  4. Select a Relative or Absolute path. For more information, see Using absolute and relative target paths.
  5. If required, select settings for the behavior parameters and click OK.

    Default event and actions for the behavior appear in the Behaviors panel.

  6. Under Event, click On Release (the default event) and select a mouse event from the menu. If you want to use the On Release event, leave the option unchanged.