 |
|
Flash Article
|
 |
 |
 |
| |
| |
|
Note: This tutorial is a legacy tutorial for Flash MX users only; it does not describe best practices for using video in Macromedia Flash MX 2004. At this point, we only recommend embedding video within the Flash while using very small video files. In general, you should use progressive download (placing an FLV external to the movie), which Macromedia introduced in Flash MX 2004 and Flash Player 7, or streaming (placing the FLV on a Flash Communication Server). Here are some additional resources to help you get started with the much-improved video features in Flash MX 2004:
Introduction
Although
Macromedia Flash MX allows you to easily insert digital
video into your SWF files, there are some limitations and
recommended best practices when deploying video in your
Flash movies. Make sure to follow these guidelines to ensure
optimal performance. Also, if you plan on using video in
your Flash movies, be sure to check out the new video components
that are available on the Macromedia
MX Developer Resource Kit.
|
| |
 |
| The Property
inspector provides you with an interface to specify playback
settings. |
| |
| |
Background
Originally Macromedia Flash was designed as a vector animation
program. If you'd like to read about the evolution of the
software, check out The
History of Flash. The original concept was based on the
ability to create a sketch using a pen tool (similar to a
Wacom pen). A good idea grew even greater, as a scripting
language was added to allow programmatic manipulations of
the elements on the stage. Macromedia Flash MX is the newest
incarnation of this legacy and provides even more flexibility
and opportunity for creative control. |
| |
| Because
there are so many options available, it is important to plan
each project carefully. While Macromedia Flash MX is a robust
authoring environment that allows you to create complex interfaces
and intricate animations, it was not designed to perform all
available functions at once. Video playback uses a significant
amount of resources, and therefore should be balanced with
the other elements that exist in the movie. |
| |
| Some
of the issues you may encounter when deploying video are based
on the fact that any type of media which is loaded into the
SWF file will be stored in memory. Back in the days when files
were not supposed to be larger than a few kilobytes, this
consideration did not matter. But it certainly does today,
especially when working with elements with larger file sizes. |
| |
Stitch
your videos together
Imagine that you are trying to display several megabytes
of video in your Flash project. Roughly every minute of
web quality video will consume at least 1MB in your SWF
file. Although 1MB may not sound like a lot—keep in
mind that the client machines might not have as much memory
as you have. Also consider that users running Macintosh
systems with OS 9 may experience degraded performance, since
the memory allocation is fixed.
A good workaround for this problem is to 'stitch' your
media. This is a process that involves splitting the videos
up into separate SWF files, then using loadMovie to load
them in sequence. Sorenson
Squeeze supports video stitching.
Many developers have often wondered about the limitation
that you should set for each SWF. In my experience, 4MB
SWF files will work fine on most client platforms. |
| |
 |
| Media
symbols in the Library. The Library organizes the elements
within your movie. |
| |
Use
non-fractional frame rates
Another set of issues revolves around the synchronization
of audio and video tracks. If a SWF file does not contain
any streaming sound, the frame rate is not predictable across
platforms. This issue by itself does not pose a problem, since
the viewer will barely notice it and correct timing is not
necessary when there is no accompanying soundtrack. |
| |
| However,
if you are using streaming sound files, you may notice that
the Macromedia Flash Player will exhibit an interesting behavior.
This behavior stems from the fact that it automatically tracks
the number of audio samples it has played, in order to synchronize
the main movie. The Macromedia Flash Player is also aware
of the number of samples each frame is supposed to last. To
be more precise, this number of samples is not an integer.
Instead, this information is stored as a fractional number
based on some of the more common frame rates. That means that
the Macromedia Flash Player will play back those movies too
fast—since the fraction is cut off in its calculations. |
| |
| A good
workaround for this problem is to specify "whole"
frame rates, (in other words, set your movie's frame rate
to a number which will result in non-fractional sample counts). |
| |
| Here
is a list of recommended frame rates to use: |
| |
| 10,
15, 18, 21, 30. |
| |
| Try
to avoid common frame rates, such as 12 and 24. These settings
may cause your elements to play at an accelerated rate. |
| |
| To
learn more about preparing video to use in your Flash project,
see Using
embedded video in Macromedia Flash MX. |
| |
| |
|
| About the author |
| Tinic Uro
is a Senior Flash Engineer at Macromedia.
|
| |
|
|
|
|
|
|