Accessibility

Macromedia Flash Article

Controlling Media Components with Flash Behaviors


Dan Carr

Dan Carr

dancarrdesign.com

Table of Contents

  1. Introduction
  2. Behavior 1: Seek to Cue
  3. Behavior 2: Seek to Time
  4. Behavior 3: Set URL from List Component
  5. Behavior 4: Set Video Stream
  6. Behavior 5: Toggle AutoSize
  7. Behavior 6: Toggle Play/Pause

Displaying video content is easier than ever before in Macromedia Flash MX Professional 2004 thanks to the new media components that display video saved in the FLV format.

The standard approach for applying settings to a component is to adjust its parameters in the Component Inspector panel while authoring in the FLA file. But what if you need dynamic control of the video display while the movie is running?

Conveniently enough, Flash components have functions and parameters you can manipulate through ActionScript. Even more helpful is the addition of behaviors in Flash MX 2004 that allow beginning and advanced users to add prebuilt ActionScript to buttons, screens, and other objects in a Flash movie.

This article provides six custom behaviors that I designed to access functional control over video files playing in a Media Playback component. These behaviors are simple and easy to use. With the included sample files you'll be able to seek to a cue point or a time in the video; designate a video source for the component or choose a video source from a list of choices in a List component; and set up simple toggle behaviors to control play, pause, or autosize properties.

Requirements

To complete this tutorial you will need to install the following software and files:

Macromedia Flash MX Professional 2004

Extension Manager 1.6


Video Update: Exporter and Updated Media Components (Updated 1/30/04)

This update resolves issues identified with the Flash Video Exporter and Media Components in Flash MX Professional 2004. All users creating video projects in Flash on any language should install this update.

Media Behaviors extension

Sample files

To use this tutorial, you should also be familiar with the basics of creating and running movies using Macromedia Flash MX 2004. For more resources, check out the Flash Developer Center's Video Resources page.

Other assumptions and requirements:

  • Although this tutorial works with the supplied files, the Media components are available only in the Components panel in Flash MX Professional 2004.
  • The Media components display FLV formatted video files. You can export them using the Flash Video Exporter plug-in in any supported video editing application or export them directly from Flash MX 2004. (See the FLV topic in the Help pages.)
  • You must install the supplied MXP file using Extension Manager 1.6 before you can use the custom behaviors.


About the author

Dan Carr is owner, lead developer, and trainer for Dan Carr Design in San Francisco. With years of history developing for Macromedia, Dan has created a range of features for Flash, including e-learning templates and UI components for Flash MX Professional 2004. Dan teaches Flash design and ActionScript classes in San Francisco and develops e-learning and web applications for the public, as well as for Macromedia product teams.