Using Media components
Media components are used to display FLV files or play MP3 files in a SWF file, and they only
support these two file types. You can export each file format using a variety of software. For
information on exporting the FLV format, see
Media components are easy to use, so you do not have to write ActionScript to dynamically load
FLV files. The components are available only in Flash MX Professional 2004, but you can use
them to dynamically load FLV files into a SWF file.
Note: MP3 and FLV files progressively download into a SWF file. Use Flash Communication Server
to stream media to a SWF file.
There are several ways that you can load video into a SWF file using Media components. The
following procedure is the basic recommended way to use Media components; however, there are
many additional settings you can make.
To use Media components:
Drag a MediaPlayback or MediaDisplay component onto the Stage.
1.
Select the component instance, and use the Component inspector panel to enter the file format
2.
and location of the media that you want to dynamically load into your SWF file.
Select how you want your video controls to appear.
3.
Use the Component inspector panel to set the location of the controls and whether they are
4.
visible, hidden, or minimized during video playback.
Enter the length of the FLV file for the playhead to recognize the length of the video and follow
5.
the video as it plays.
Note: See the following example to determine the length of an FLV file using ActionScript.
Note: You can enter additional properties and cue points using the Component inspector panel.
The recommended way to find out the length of an FLV file is to use code in the following
format:
var listenerObject:Object = new Object();
listenerObject.complete = function(evt:Object) {
trace("seconds: "+evt.target.playheadTime);
};
myMedia.addEventListener("complete", listenerObject);
After the FLV file finishes playing in the Media component called
number of seconds of the video in the Output panel.
Dynamically loading video using ActionScript
You do not have to use Media components to dynamically load FLV files into a SWF file. You can
use ActionScript with a Video object instance to load the video into a SWF file at runtime.
"Exporting FLV files" on page
myMedia
111.
, it displays the total
Video conventions
113
Need help?
Do you have a question about the FLASH MX 2004-USING ACTIONSCRIPT IN FLASH and is the answer not in the manual?
Questions and answers