Flash Video 101: Controlling Flash Video with the FLV Playback Component
This 10-part series of articles explores the capabilities and potential of authoring and publishing Flash video on the World Wide Web. This article discusses how to configure and employ a new component, the FLVPlayback component, to control the playback of your Flash video.
You actually have several options for controlling the playback of video in a Flash file.
- Using FLVPlayback component: New in Flash 8, the
FLVPlayback component enables you to quickly add full-featured, intuitive video
controls for FLV or MP3 playback in your Flash movie. The FLVPlayback component,
available in Flash Professional 8 only, provides support for both progressive
downloading and streaming FLV files. It also enables the use of premade skins,
or you can apply your own custom skins to the video interface (See Figure
Figure 1 FLVPlayback component with a premade skin
- Controlling external video playback using ActionScript: You can play back external FLV files in a Flash document at runtime using the NetConnection and NetStream ActionScript objects. (For more information, see "About Playing Back External FLV Files Dynamically" in Flash Help.)
- Using video behaviors: You can use prewritten snippets of
ActionScript, referred to as behaviors, to control video playback (see
Figure 2 Flash 8 embedded video behaviors
- Controlling video playback in the Timeline: If you are comfortable with ActionScript, you can write custom ActionScript to control video playback. You can play or stop a video, jump to a frame, and control video in other ways. You can also display a live video stream from a camera.
As mentioned above, this article focuses on the first option: controlling your Flash video with the FLVPlayback component.
Flash 8 contains prebuilt components that help you automate complex, time-consuming, or repetitive tasks. Components are a special type of prebuilt movie clip with parameters that enable you to modify their appearance and behavior.
For example, the user interface components enable you drop premade scroll bars, data grids, buttons, and much more directly onto the stage instead of going through the labor-intensive task of building them from scratch.
Flash contains a variety of components (see Figure 3), organized into the following categories:
- Data components (mx.data.*): Data components enable you to load and manipulate information from data sources; the WebServiceConnector and XMLConnector components are data components.
- User interface components (mx.controls.*): User interface components (often referred to as UI components) enable you to interact with an application; for example, the RadioButton, CheckBox, and TextInput components are UI controls.
- Managers (mx.managers.*): Managers are nonvisual components that enable you to manage a feature, such as focus or depth, in an application. The FocusManager, DepthManager, PopUpManager, StyleManager, and SystemManager components are manager components.
- Screens (mx.screens.*): The screens category includes the ActionScript classes that enable you to control forms and slides in Flash.
- Media components (mx.controls.*): Media components enable
you to play back and control streaming media. MediaController, MediaPlayback,
and MediaDisplay are media components.
Figure 3 Components in the Flash 8 components panel
There are four general phases of working with components:
- Adding the component to your project file.
- Configuring the component.
- Modifying the component themes to change their appearance.
- Writing ActionScript to enhance performance or gather and submit data.
Of most interest to us here are the media components — in particular, the FLVPlayback component.