Chapter 10: Incorporating Sound and Video

Chapter 10: Incorporating Sound and Video
Flash CS4
THE
MISSING
MANUAL
®
Chris Grover with
E.A. Vander Veer
Beijing • Cambridge • Farnham • Köln • Sebastopol • Taipei • Tokyo
This excerpt is protected by copyright law. It is your
responsibility to obtain permissions necessary for any
proposed use of this material. Please direct your
inquiries to permissions@oreilly.com.
chapter
Chapter 10
10
Incorporating Sound
and Video
You can create almost any kind of picture or effect in Flash, but sometimes you
already have the perfect piece of sound or video…and it’s in another file. No problem: Flash lets you pull in all kinds of other media files—like songs in MP3 files or
QuickTime videos. Whether you’re showcasing your band’s performances, creating an employee training Web site, or creating an online wedding album, Flash has
all the multimedia tools for the job.
When Flash was born, it was a big deal to have moving pictures on the Internet.
Most folks had pretty slow Internet connections, so it was kick to see pictures
move, even if they were simple cartoonish images. The same was true of even the
most basic sound effects. Today, we’re used to full screen video delivered over the
Net, and sounds have gone from beeps and bells to radio broadcasts, audio books,
and entire albums of music. Things have changed, and Flash is at the center of the
revolution.
One change, of course, is the number of people who use fast Internet connections.
The other change came when Web developers began to use Flash video (FLV).
Most of the Web browsers in the world have Flash capabilities—Adobe’s estimates
are way above 90%. For you, the good news is that when you wrap your audio and
video offerings in Flash, you don’t have to force your audience to download and
install yet another plug-in. This chapter explains how to add sound to your animations and how to edit that sound for the best fit. You’ll also learn how to present
video in a predesigned component that gives the audience playback controls.
341
Incorporating Sound
Incorporating Sound
Flash lets you score your animations much the same way a filmmaker scores a
movie. You can add a soundtrack that begins when your animation begins and
ends when it ends. Or you can tie different sound clips to different scenes (series of
frames) of your animation. For example, say you’re creating an instructional animation to demonstrate your company’s egg slicer. You can play music during the
opening seconds of your animation, switch to a voice-over to describe your product, and then end with realistic sounds of chopping, slicing, and boiling to match
the visual of cooks using your product in a real-life setting.
You can also tie sounds to specific events in Flash. For example, say you want your
instructional animation to contain a button someone can press to get ordering
information. You can tie the sound of a button clicking to the Down state of your
button, so when someone clicks your button, she actually hears a realistic clicking
sound.
Note: Early on (that is, before version 8), Flash included a library of sound effects you could add to your
animations. Now in Flash CS4, the Sounds Library is back, and crammed full of noises made by animals,
machines, and nature. To add a library sound to your animation, choose Window ➝ Common Libraries
➝ Sounds, and drag a sound to the stage.
Importing Sound Files
Before you can work with sound in Flash, you need to import a sound file either to
the stage, the Library, or both. Flash lets you import a variety of sound files, as you
can see in Table 10-1.
Table 10-1. Audio file formats you can import into Flash
342
File Type
Extension
Note
MPEG-1 Audio Layer 3
.mp3
Works on both Mac and Windows.
Windows Wave
.wav
Works on Windows only, unless you have
QuickTime 4 (or later) installed; then you can
import .wav files into Flash on the Mac, too.
Audio Interchange File format
aiff, .aif
Works on Mac only, unless you have QuickTime 4 (or later) installed; then you can import
AIFF files into Flash running in Windows, too.
Sound Designer II
.sd2
Only works on Mac, and only if you have
QuickTime 4 (or later) installed.
Sound-only QuickTime movies
.mov, .qtif
Works on both Windows and Mac, but only
if you have QuickTime 4 (or later) installed.
Sun AU
.au
Works on both Windows and Mac, but only
if you have QuickTime 4 (or later) installed.
Flash CS4: The Missing Manual
Incorporating Sound
To import a sound file:
1. Select File ➝ Import ➝ “Import to Library”.
The “Import to Library” dialog box appears.
2. In the “File name” field, type the name of the sound file you want to import
(or, in the file window, click the file to have Flash fill in the name for you).
To see the different types of sound files you can import, you can either click the
drop-down menu at the bottom of the “Import to Library” dialog box, or check
out Table 10-1.
3. Click Open (“Import to Library” on a Mac).
The “Import to Library” dialog box disappears, and Flash places a copy of the
imported sound file into the Library (Figure 10-1, top). When you click to
select any of the frames in your timeline, the Sound subpanel appears in the
Properties panel.
Figure 10-1:
The visual representation
Flash displays when you
select an imported sound
clip is called a waveform.
(As discussed on page 349,
you use this waveform
when you’re editing a
sound clip in Flash.)
When you click the
Play button that Flash
displays along with the
waveform, you can
preview the sound. Flash
puts a copy of your
imported file in the
Library and makes the
imported file available in
the Properties panel.
Sound in library
Select sound
Chapter 10: Incorporating Sound and Video
343
Incorporating Sound
Adding an Imported Sound to a Frame (or Series of Frames)
You can tell Flash to play an animated sound beginning with any frame of your
animation. Depending on the settings you choose, Flash keeps playing the sound
file either until it finishes (regardless of whether your animation is still playing or
not) or until you tell it to stop.
The example below shows you how to use the stream option to synchronize a short
sound clip of a fly buzzing with an animated sequence showing—what else?—a
buzzing fly. Then you’ll learn how to start and stop a second sound (the sound of
the fly becoming a frog’s lunch).
To add an imported sound to a series of frames:
1. Open the file happy_frog.fla.
You can find this file on the “Missing CD” page at http://missingmanuals.com/cds.
(To see a working version, check out happy_frog_sound.fla.)
2. In the Layers window, click to select the topmost layer (Guide: Layer 1).
Flash highlights the layer name, as well as all the frames in that layer.
3. Select Insert ➝ Timeline ➝ Layer.
Flash creates a new layer and places it above the selected layer.
Double-click the new layer name, and then type in soundtrack, as shown in
Figure 10-2.
Select name
Sound in library
344
Flash CS4: The Missing Manual
Figure 10-2:
Technically speaking, you
can add a sound clip to any
layer you like. But if you’re
smart, you create a separate
layer for your sounds (some
folks even create a separate
layer for each sound).
Creating separate layers
helps keep your keyframes
from becoming so cluttered
that you can’t see everything
you’ve added to them. It
also helps you find your
sounds quickly in case you
want to make a change
down the road.
Incorporating Sound
Tip: You add a sound to a button the same way you see shown here, but with two exceptions: You typically add a sound file for a button to the button’s third, or Down, frame (so that the sound plays when
your audience clicks down on the button) and you leave the synchronization option set to Event. To see
an example, check out the file button_sound.fla on the “Missing CD” page.
DESIGN TIME
Using Sound Effectively
If you’ve ever watched a movie that had a breathtakingly
beautiful (or laughably cheesy) musical score, you’ve experienced the power of sound firsthand. Effective sound can
elevate a decent visual experience into the realm of art.
Ineffective sound can turn that same visual experience into
a nerve-shredding mess.
If you’re thinking about adding sound to your animation,
consider these points:
• Why do you want to add sound? If your answer
is to add emotional punch; to cue your audience
aurally to the interactive features you’ve added to
your animation, like buttons that click or draggable
objects that whoosh; or to deliver information you
can’t deliver any other way (like a voice-over
explaining an animated sequence or realistic sounds
to accompany the sequence); then by all means go
for it. But if your answer is “Because I can,” you
need to rethink your decision. Sound—as much as
any graphic element—needs to add to the overall
message you’re trying to deliver or it’ll end up
detracting from that message.
• Are you sure your audience will be able to
hear your sound? Sound files are big. They take
time to download. If you’re planning to put your
animation on a Web site, Flash gives you a couple of
different options for managing download time—but
keep in mind that not everyone in your audience
may have a fast connection or the volume knob on
her speaker turned up. (For that matter, some folks
can’t hear. Check out the box on page 30 for tips on
providing hearing-impaired folks with an alternate
way of getting your information.)
• How important is it that your soundtrack
matches your animation precisely? Flash gives
you options to help you synchronize your sound
clips with your frames. But you can’t match a 2-second sound clip to a 10-second animated sequence
without either slowing down the sound or speeding
up the animation. If you want to match a specific
sound clip to a specific series of frames, you may
need to edit one (or both) to get the balance right
before you begin synchronizing them in Flash.
4. Click the first keyframe in the soundtrack layer.
In the Properties panel, Flash activates the Frame properties. With a sound file
in the Library, the Sound subpanel appears in the Properties panel.
5. In the Sound subpanel, click the Name drop-down menu, and then choose the
imported sound file fly_buzz.wav.
Alternatively, you can drag the sound file symbol from the Library to the stage.
Either way, the sound properties for the file appear at the bottom of the Properties panel, and the waveform for the buzzing fly sound appears in the
soundtrack layer (Figure 10-3).
Chapter 10: Incorporating Sound and Video
345
Incorporating Sound
Figure 10-3:
It’s rare that the length of
a sound clip precisely
matches the length of the
animated clip to which
you want to assign it.
Here, the sound clip
stretches only to
Frame 14—but the layer
showing the buzzing fly
stretches all the way to
Frame 20. You could cut
and paste the sound to
fill those last four
frames so that the
fly doesn’t become
uncharacteristically silent
all of a sudden, but Flash
gives you much easier
ways to match a sound
clip to a frame span:
streaming, repeating,
and looping.
Expanded layer
Sound file details
Note: If you don’t see the waveform in the timeline after you’ve added it, click the first keyframe, and
then Shift-click Frame 20 to select all of the frames, from 1 to 20. Finally, choose Insert ➝ Timeline ➝
Frame.
6. In the Properties panel, click the Sync field, and then, from the first drop-down
list that appears, choose Stream.
Your synchronization choices include:
• Event. Tells Flash to give the sound its very own timeline. In other words,
Flash keeps playing the sound until the sound finishes, regardless of whether
or not the animation has ended. If you repeat (or loop) the animation in the
Controller, Flash begins playing a new sound clip every time the animation
begins again—with the result that, after a dozen or so loops, you hear a
dozen flies buzzing! Flash assumes you want your sound to behave this way
unless you tell it otherwise.
• Start. Similar to Event, but tells Flash not to begin playing a new sound if the
animation repeats.
• Stop. Tells Flash to stop playing the sound.
• Stream. Tells Flash to match the animation to the sound clip as best it can,
either by speeding up or slowing down the frames-per-second that it plays
the animation. This option is the one you want for lip-synching, when you’re
346
Flash CS4: The Missing Manual
Incorporating Sound
trying to match a voice-over to an animated sequence featuring a talking
head. Because choosing this option also tells Flash to stream the sound file
(play it before it’s fully downloaded in those cases where you’ve put your
animation on a Web site), someone with a slow connection can get a herkyjerky animation.
Tip: To preview your newly added sound on the stage, drag (scrub) the playhead along the timeline. You
can scrub forward or backward. To hear just the sound in a specific frame, Shift-click the playhead over
that frame. Flash keeps playing the sound until you let up on either the Shift key or the mouse.
7. From the second drop-down menu next to the Sync field, choose Loop.
Loop tells Flash to repeat the sound clip until the animation ends. Repeat lets
you tell Flash how many times you want it to play the sound clip (regardless of
the length of the frame span).
8. Test the soundtracked animation by choosing Control ➝ Test Movie.
You hear a buzzing sound as the fly loops its way across the test movie.
9. Add a second, short sound clip to your animation to make the scene more realistic. To do so:
In the soundtrack layer, click Frame 20.
On the stage, you see the frog’s tongue appear (Figure 10-4).
10. Select Insert ➝ Timeline ➝ Blank Keyframe, or press F6.
Flash places a blank keyframe (a hollow circle) in Frame 20.
11. In the Sound subpanel, click the arrow next to Name, and then, from the dropdown list that appears, choose zot.wav.
Flash places the waveform for the sound file into the timeline, beginning with
Frame 20.
Tip: If you need a better view of the sound’s waveform in your timeline, right-click the layer with the
sound, and then choose Properties. The Properties panel opens. At the bottom set the layer height to
either 200% or 300%, as shown in Figure 10-3.
12. In the Properties panel, click the arrow next to Sync, and then, from the dropdown list that appears, choose Start. Then, in the soundtrack layer, click to
select Frame 22.
On the stage, you see a very satisfied frog (Figure 10-5).
13. Select Insert ➝ Timeline ➝ Blank Keyframe or press F6.
Flash places a blank keyframe (a hollow circle) in Frame 22.
Chapter 10: Incorporating Sound and Video
347
Incorporating Sound
Figure 10-4:
Beginning sound clips in individual
keyframes lets you change the
soundtrack at the exact moment
your visuals change. Here, you see
the frog’s tongue appear in Frame
20 of the frog layer, and it doesn’t
change until Frame 22 (which
contains the final keyframe of the
animation). So to match the “zot!”
sound to the tongue action, you
want to tell Flash to start playing
the zot.wav file on Frame 20 and
stop playing it on Frame 22.
Figure 10-5:
Because the synchronization option
for the “zot!” sound was set to start
in Frame 20, Flash automatically
stops playing the zot.wav sound file
when the animation ends. Still, it’s
good practice to tell Flash
specifically when you want it to
stop playing a sound file. You’ll be
glad you did when you come back
to the animation a week or two
later because you won’t have any
cleanup to do before you add
additional sounds to the timeline.
348
Flash CS4: The Missing Manual
Incorporating Sound
14. In the Sound subpanel, click the Name drop-down menu, and then choose zot.wav.
Click the arrow next to Sync, and then, from the drop-down list that appears,
choose Stop.
You’re done!
15. Test the new sound by choosing Control ➝ Test Movie.
You hear a buzzing sound as the fly loops its way across the test movie. But as
the frog’s tongue appears, the buzzing stops and you hear a satisfying “zot!”
Tip: If you don’t hear any sounds, select Control and see whether the checkbox next to Mute Sounds is
turned on. If it is, click it to turn it off.
DESIGN TIME
Stock Images, Sounds, and Video Clips
If you’re using Flash to create stuff for work—presentations,
tutorials, Web advertisements, marketing materials, or what
have you—you or someone else on your team is probably
going to be creating all your content from scratch. But
there’s a place in every Flash fan’s toolkit for stock media:
generic images, sound clips, and video clips that you purchase (or, more rarely, get for free) from companies whose
job it is to produce such items.
But even professional animators have been known to rely
on stock media occasionally because it lets them test out a
concept quickly and cheaply.
Typically, you pay a modest fee to use stock images,
sounds, and video clips. Sometimes, you also pay a royalty
fee based on the number of times you use a stock element
in your animation.
www.bigshotmedia.com
If you’re using Flash to jazz-up your personal Web site, you
may find stock media is just what the doctor ordered: You
get something cool that you can use for a relatively low
price without having to invest time and money buying
audio and video equipment and tracking down that
twister yourself.
www.a1freesoundeffects.com/household.html
Places to find stock images, sound clips, and video clips
abound on the Web. Here are a few you might want to
check out:
www.freestockfootage.com
www.wildform.com/videolibrary
www.flashkit.com/soundfx
www.findsounds.com
www.gettyimages.com
Editing Sound Clips in Flash
You can change the way your imported sound clips play in Flash. You can’t do
anything super-fancy, like mix down multiple audio channels or add reverb—
Flash isn’t a sound-editing program, after all—but you can crop the clips, add simple fade-in/fade-out effects, and even choose which speaker (right or left) they play
out of.
Chapter 10: Incorporating Sound and Video
349
Incorporating Video
First, import the sound clip you want to edit, as described on page 342. To edit it,
follow these steps:
1. In the timeline, click any frame that contains a portion of the sound clip’s
waveform.
Flash activates the sound options you see in the Properties panel.
2. In the Properties panel, click the drop-down box next to Effect, and then
choose from the following menu options:
• Left channel. Tells Flash to play the sound through the left speaker.
• Right channel. Tells Flash to play the sound through the right speaker.
• Fade left to right. Tells Flash to begin playing the sound through the left
speaker, and then switch midway through the clip to the right speaker.
• Fade right to left. Tells Flash to begin playing the sound through the right
speaker, and then switch midway through the clip to the left speaker.
• Fade in. Tells Flash to start playing the sound softly, and then build to full
volume.
• Fade out. Tells Flash to start playing the sound at full volume, and then taper
off toward the end.
• Custom. Tells Flash to display the Edit Envelope window you see in
Figure 10-6, which lets you choose the in point (the point where you want
Flash to begin playing the sound) and the out point (where you want the
sound clip to end). You can also choose a custom fading effect; for example,
you can fade in, then out, then in again.
Note: Clicking the Property panel’s Edit button displays the same Edit Envelope window you see when
you choose the Custom option.
Incorporating Video
In the past few years, Flash has become the video champion of the Internet. You
find Flash video on sites from YouTube to CNET. It wasn’t long ago that a battle
royale raged between Microsoft, Apple, and RealMedia for Web video bragging
rights. Flash was seldom mentioned in the contest; after all, it was just for making
little animations. But, like the Trojans with their famous horse, Flash Player managed to sneak onto about 90% of today’s computers. And guess what? Flash does
video, too. It’s easy for you to add video to a Web page or any other project by
adding it to a Flash animation. It’s easy for your audience, too, since they don’t
have to download and install a special plug-in to watch your masterpiece. Flash is
also fueling the recent surge in video blogging, or vlogging—adding video clips to
plain-vanilla Web logs. You can find out more at sites like www.vidblogs.com and
www.wearethemedia.com.
350
Flash CS4: The Missing Manual
Incorporating Video
Click to edit sound
Time in
Time out Envelope handles
Show frames
Show seconds
Play
Figure 10-6:
The sound file you see
here is a two-channel
(stereo) sound, so you
see two separate
waveforms, one per
channel. To crop the
sound clip, drag the Time
In and Time Out control
bars left and right. Flash
ignores the gray area
during playback and
only plays the portion
of the waveform that
appears with a white
background, so here
Flash only plays the
second half of the
waveform. To create
a custom fading effect,
you can drag the
envelope handles
separately. These
settings tell Flash to fade
out on the left channel
while simultaneously
fading in on the right
channel. To preview your
custom effect, click the
Play icon.
Tip: If you’re watching a video on the Web and wondering whether the site uses Flash to publish it, rightclick the video. If you see “About Flash Player…“ in the shortcut menu, you know Flash is working behind
the scenes.
May as well face it: sometimes video footage is more effective than even the most
well-crafted animation. For example, video footage showing a live product demonstration, a kid blowing out the candles on his birthday cake, or an interview with a
CEO can get the point across quicker than any other medium.
There are two basic steps to creating Flash video:
• Convert your video to the Flash video file format: .flv or .f4v. Before you can
add video to your Flash animation, you have to convert it to a special file format. The process, which video techies call encoding, creates small files that can
travel quickly over the Internet. Flash comes with the Adobe Media Encoder,
which lets you convert most types of video into Flash video format. The next
section describes the encoding process.
Chapter 10: Incorporating Sound and Video
351
Incorporating Video
Note: Adobe is working hard to keep Flash at the forefront of the Internet video revolution. With version
9.0.124 of the Flash Player (codenamed Moviestar), Adobe added capabilities for HD (high definition)
video and audio, similar to what you find in Blu-Ray DVDs. The amount of data needed for HD video
would overwhelm most of today’s Internet connections, but it’s certainly an indication of what to expect in
the future.
• Import your video into a Flash animation. Once your video clip is in Flash
video format, you can import it into your project. Flash stores a copy of the
video in the Library, and you can drag the video to the stage like any other
graphic. It’s remarkably easy to add video playback controls to your Flash video.
If you have a video that’s already in the Flash video format (.flv or .f4v), you can
jump ahead to page 365 to learn how to import it into your Flash file.
Note: Neither Flash nor the Adobe Media Encoder let you do extensive editing. At best, they let you crop
a segment out of a larger video clip. If you’re interested in piecing together different video segments to
create a movie or a scene, turn to a specialized video editing program like Adobe Premiere or Apple Final Cut
Pro. If your needs are more modest, you can probably get by with Apple’s iMovie or Microsoft’s MovieMaker.
Using those programs, you can either save clips as Flash video, or you can save clips in a different format
(.mpg, .mov, or .avi), and then convert them using Adobe Media Encoder.
Encoding: Making Flash Video Files
Video files are notoriously huge, which means standard video files take a long time
to travel the Internet. To solve this problem, Flash uses special video formats that
shrink or compress video into smaller files. The quality might not be what you’d
expect from your 50-inch plasma HDTV, but it’s certainly acceptable for Web
delivery. The process of converting a video from its original format to Flash video
(.flv or .f4v) is called encoding. If you already have a file in the Flash video format
or if someone else is responsible for this part of the job, you can jump ahead to
“Importing Video Files” on page 365.
Using the Adobe Media Encoder, you can encode any of the common video files
listed in Table 10-2. As explained in the box on page 356, it’s best to start off with a
high quality, uncompressed video. You can add prebuilt controls that let your
audience control the playback and adjust the volume. You can even apply effects to
a video clip in Flash: for example, skewing and tinting.
Table 10-2. video file formats you can convert to Flash Video with Adobe Media Encoder
352
File Type
Extension
Note
QuickTime movie
.mov
The audio/video format.
Apple’s video player uses. A free version of
QuickTime player is available for both Macs
and PCs.
Audio Video Interleaved
.avi
Microsoft audio/video format.
Flash CS4: The Missing Manual
Incorporating Video
Table 10-2. video file formats you can convert to Flash Video with Adobe Media Encoder (continued)
File Type
Extension
Note
Motion Picture Experts Group
.mpg, .mpeg
MPEG-1 is an early standard for compressed
audio and video media.
MPEG-2 is what standard DVDs use.
MPEG-4 Part 2 is used by the DivX and Xvid
codecs.
MPEG Part 10 is used by QuickTime 7 and the
H.264 codec.
Digital video
.dv
Many camcorders use this digital video format.
Windows Media
.asf, .wmv
These Microsoft formats are for compressed
audio/video files.
Flash video
.flv, .f4v
Flash’s video format employs a “lossy” compression technique to produce very small files
suitable for broadcast over the Internet.
The hardest part of encoding video files is the wait. It takes time to encode large
video files, but it’s getting better with today’s faster computers. Flash CS4’s
installer automatically puts Adobe Media Encoder on your computer. Fire it up,
and it looks like Figure 10-7. There are two basic things you need to do: locate the
file you want to encode, and give Adobe Media Encoder instructions about how to
process it. Here are the steps:
Figure 10-7:
Adobe Media Encoder
is a multipurpose
conversion tool that
comes with several
different Adobe products,
including Flash. You add
media files to the queue
and tell Flash what type
of file you want it to
produce.
Chapter 10: Incorporating Sound and Video
353
Incorporating Video
1. In Adobe Media Encoder, click Add.
Flash displays a standard Open window similar to the one you use to open a
Flash document.
2. Navigate to the file on your computer that you want to encode, and then click
Open.
The name of the video file appears under Source Name.
3. Under Format, choose the Flash video format: FLV/F4V.
Flash video files automatically determine whether your fill is encoded in the
FLV or the F4V format. That determination depends on the preset you choose
in the next step. Flash gives you these presets (predetermined settings) because
choosing all the settings to encode video can be ridiculously complicated. Even
when you choose a file format like FLV or F4V, there are still dozens of settings
you can choose based on how the video is distributed and viewed. Adobe helps
you wade through the swamp of video settings by providing presets for common video needs.
4. Under Preset, choose a preset format that matches your project.
Flash has what may seem like a bewildering number of presets as shown in
Figure 10-8. The names are marginally descriptive. If your project is destined
for a Web page, try FLV – Web Medium to start. The FLV format works with
Flash Player 8 and 9. The F4V formats show better quality video in smaller files,
but work only in Flash Player 9. Experienced videographers may want to tweak
the encoding settings or trim the video clip before it’s encoded.
5. Under Output you can change the name or location of the file.
If you don’t make any changes under Output, the encoded file appears in the
same folder as the original video file. It has the same name, but will end with
either .flv or .f4v.
6. Click Start Queue.
Adobe Media Encoder starts to encode your file. A bar at the bottom of the
window tracks the progress (Figure 10-9). If you have several files to encode,
you add them all to the queue before you hit Start Queue. The encoder makes
no changes to the original file. When the encoder is finished, a checkmark
appears next to the file in the queue, and you have a new file with a .flv or .f4v
extension.
Batch encoding to save time
No matter how you cut it, encoding video takes time and can slow down your
computing workflow. If you have lots of video to encode, prepare several video
clips for encoding using the steps described in this section. You can add several
encoding jobs to the encoding queue, and then run them all at the same time when
354
Flash CS4: The Missing Manual
Incorporating Video
Figure 10-8:
When you first use Adobe Media Encoder, it’s
best to use one of the presets that match
your project. Later, you may want to create
your own settings by clicking Edit Export
Settings.
you click Start Queue. Why not do all that encoding overnight or when you head
out to lunch?
Figure 10-9:
While the Media Encoder
processes your file, it
keeps you updated with
a progress bar and the
Estimated Remaining
time. The video also
appears in a preview
window.
Progress bar
Estimated
remaining time
Chapter 10: Incorporating Sound and Video
355
Incorporating Video
UP TO SPEED
Over-Compression: Too Much of a Good Thing
The final destination for many Flash projects is a Web site.
One of Flash’s great virtues is the ability to present animations, video, and sound over the Web without making the
audience wait while humongous files travel the Internet.
Flash makes big files small by compressing them. It uses
different compression methods for images, sound files, and
video files. Some types of compression actually degrade
the image, sound, or video quality. It’s a tradeoff, but it’s the
best way to create really small files that travel the Net fast.
The idea is to keep as much information as is needed to
maintain acceptable quality and throw out the extra bits.
These types of compression schemes are called lossy formats because they lose data and as a result lose quality.
Examples of lossy formats are: JPEG photo files, MP3 audio
files, and FLV or F4V Flash video files. While compression is
a good thing because it keeps the file size down and helps
Web-based Flash animations load quickly, it’s possible to
over-compress a file. One way that happens is when you
compress a file that’s already been compressed.
If you repeatedly compress photos, sound files and video
files you can end up with media mush. For example, take a
JPEG and save it five times using 50% quality and you find
that the last copy is much poorer in quality than the first.
You can do the same thing to MP3 audio files and video
files. Ideally, it’s best to bring uncompressed files into Flash,
and then let Flash do the compression once, when it publishes a SWF file. For audio files, that means it’s best to use
uncompressed AIFF files on a Mac or WAV files on a PC. For
video files, use video that hasn’t already been compressed.
With video, the compression takes place when you use the
Adobe Media Encoder to make .flv or .f4v files. So, if you
just shot the video with your camcorder, feed the raw .dv
file to Adobe Media encoder for the best results. If the file
is coming from someone else, ask him to give you the best
quality possible.
Encoding Part of a Video Clip
There are a few reasons why you might want to dig into Adobe Media Encoder’s
export settings before you encode a file. One of the most common scenarios is that
you have a long video and you only need to bring a small part of it into your Flash
project. To do so, follow the encoding steps that begin on page 354. When you
reach step 4, instead of choosing one of Adobe’s presets, click Edit Export Setting
at the bottom of the list. The next thing you see looks like a video editing window,
shown in Figure 10-10. You can’t do extensive editing in this window like you can
with Adobe Premiere or Apple’s Final cut, but you can select a portion of a video
clip to encode. Encoding is pretty slow business, and there’s no reason to waste
time converting video that you won’t use.
In the upper-left corner of the Export Settings window is a small preview screen.
Below the screen is a timeline with a playhead, similar to Flash’s. Drag the playhead to see different frames in your video. The two markers in the timeline below
the playhead are called the In point and the Out point. You use these two points to
select a segment of the video. As you drag either point, the preview window shows
the image (or video frame) for that point in time. A highlight appears on the
selected segment of video.
356
Flash CS4: The Missing Manual
Incorporating Video
Preview source or output
Export video and/or audio
In point Playhead Out point
Resize video
Advanced/Simple
Mode toggle
Figure 10-10:
You can’t do extensive
editing in Adobe Media
Encoder, but you can
select the portion of a
video file that you want
encode. The program
also provides tools to
resize the entire video,
select portions of the
image, and fine-tune
the video codec used
to encode your Flash
video file.
Codec options
If you want to use one of Adobe’s encoding presets, you can choose one in the
upper-right corner of the Export Settings window. (If you’d rather tweak the
export settings on your own, see page 359.) Click OK, and you’re back at the
Media Encoder, where you can change the name and location for your encoded
file, as described in step 5 on page 354. Or, you can simply click the Start Queue
button to encode the video segment you selected.
Resizing and Cropping a Video Clip
When you choose an encoding preset in Adobe Media Encoder, the preset determines the dimensions of the video image. For comparison, a wide-screen TVs
might show a high-definition image that’s 1920 pixels wide by 1080 pixels high.
When you choose the FLV – Web Medium setting, the preset encodes an image
that’s 360 pixels wide by 264 pixels high. When you’re in Export Settings, you can
choose any size you want. Understandably, large dimensions, like those for that
hi-def TV, mean much larger files. If your video is traveling the Internet, you can
dramatically reduce the travel time by reducing the video dimensions. The 360 × 264
size of the FLV – Web Medium preset is a nice compact size for the Net. If you
know everyone in your audience is going to have a fast cable or DSL connection,
you can go ahead and bump the dimension up to 640 × 480, another fairly standard
dimension for video.
Chapter 10: Incorporating Sound and Video
357
Incorporating Video
After you’ve opened Adobe Media Encoder and added a video to the encoding
queue, as described on page 354, follow these steps to choose a custom size for the
encoded video:
1. Instead of choosing one of Adobe’s presets, click Edit Export Setting at the bottom
of the list.
The Export Settings window appears, where you can fine-tune many aspects of
the encoding process.
2. On the left side of the Export Settings window, click the Video tab.
If you don’t see tabs in the Export Settings window, click the Advanced/Simple
Mode toggle button, as shown in Figure 10-10.
3. Click the Resize Video checkbox.
Once you’ve checked the Resize Video box, the encoder uses the size dimensions
entered in the next step.
4. Change the height and width dimensions, as shown in Figure 10-11.
Most of the time, you want to maintain your video’s proportions to keep the
images from looking too tall or too fat. To constrain the proportion, make sure
the Constrain width/height button is depressed. Then, you can enter either a
width or height dimension, and the other dimension automatically sizes itself.
5. Click OK.
The Export Settings window closes, and you see the Adobe Media Encoder queue.
Cropping a video while encoding
Cropping a video is just like cropping a photo. Instead of resizing the entire image,
you select a portion of the image that you want to view. With moving pictures it’s a
little trickier, because the image is changing at multiple frames per second. The
crop that looks great for the first 20 seconds of a clip might not look as good a
minute later. Also keep in mind, when you crop a video, you’re changing the
dimensions and the quality of the image. When you crop into an image too far,
you end up with a blurry picture.
To crop your video, follow the steps on page 358 to open the Export Settings window in Adobe Media Encoder. Above the preview window, click the Crop button.
A frame appears around the video image with handles at the corner. Drag the handles to frame the portion of the picture you want to keep, as shown in
Figure 10-12. If you need specific dimensions in pixels, you can click the Crop
dimension numbers, and then type new values. Keep in mind, these numbers are
showing the number of pixels being trimmed from the edges of the picture. To see
the dimensions of the cropped image, point to one of the frame handles. A tooltip
appears near the mouse cursor with the width/height dimensions in pixels.
358
Flash CS4: The Missing Manual
Incorporating Video
Resize check box
Figure 10-11:
Open Adobe Media
Encoder’s Export Settings
window to choose a
custom size for your
encoded videos. Click the
Constrain width/height
button to maintain the
picture’s original
proportions.
Video tab
Width
Constrain
width/
height
Height
Crop button
Crop dimensions
Figure 10-12:
Drag the handles in the
“crop frame” to select the
portion of the video picture
you want to keep in your
encoded video.
Crop frame
Chapter 10: Incorporating Sound and Video
359
Incorporating Video
Adding Cue Points to Your Video
Flash lets you place cue points (markers) in your movie clips, which you can then
use to trigger other actions in your Flash animation. For example, perhaps you’d
like to show text on the screen at a certain point in the video, or perhaps you’d like
to trigger a certain sound or narration track. You give cue points names—like
“narration”—as you create them. Then you use ActionScript code to identify the
cue points and trigger the actions you want performed. (There’s more on ActionScript starting in Chapter 11.)
You add cue points in Adobe Media Encoder, using the same Export Settings window
that you use to resize or crop your video.
1. In Media Encoder select Edit
window.
➝
Export Settings to open the Export Settings
You see a preview window showing your video, with a timeline underneath, as
shown in Figure 10-13. Just as in Flash, the timeline has a playhead. Drag the
playhead to a point in the timeline, and you see that frame in your video. Below
the preview, there are two panels: one for cue points and one for parameters.
Cue Point Name
Cue Point Type Delete Cue Point
Parameter panel
Figure 10-13:
You use cue points to place markers in
your video. With the help of ActionScript,
you can use the cue points to trigger
events in your animation.
Add Cue Point
2. Drag the playback head to the point in your video you want to mark.
The video image changes as you move the playback head.
3. Click the + button to add cue points; click the – button to remove them if you
make a mistake.
Flash creates a cue point in the list and gives it a name, a time setting, and a
type. The time setting is determined by the playback head’s position in the
video clip. In the next steps, you’ll change the name and type of cue point.
360
Flash CS4: The Missing Manual
Incorporating Video
4. Click the name, and then type a descriptive name for your cue point.
Flash names all cue points “cue point” when it first creates them. It’s up to you
to type something more descriptive.
5. Choose the type of cue point you want to create—Event or Navigation. If you’re
an ActionScript hotshot, set parameters.
Event cue points trigger an action when the video reaches them. Navigation cue
points let you locate and play certain portions of your video. Both Event and
Navigation cue points require ActionScript to work their magic.
6. Click the + button to add parameters to your cue point; click the – button to
remove them if you make a mistake.
Parameters are key-value pairs that programmers use to store and retrieve
information. So the parameter values are available to ActionScript programs
when the video reaches the cue point.
7. Repeat steps 2–6 to add more cue points, or click OK to go back to the encoder
queue.
Choosing a Video Codec
Part of the encoding process is choosing the codec (compressor/decompressor…get
it?) that shrinks your video as it converts it to the Flash video format. Over its
short history, Flash video has used three different codecs. The makers of Flash have
updated the Flash Player to use new codecs as they’ve become available. The new
codecs provide new features and produce better quality video using smaller file
sizes. As a Flash designer, you need to guess which version of the Flash Player your
audience is likely to have when you choose the best codec for encoding.
Flash CS4 makes these decisions relatively easy for you. If you use one of the presets
when you encode, all you need to do is choose the Flash player your audience will
use, and then decide the relative size. For example, one of the choices is FLV – Web
Medium (Flash 8 or higher). If you customize the Export Settings, you can choose
the video codec that’s used to shrink your video file to size. Here’s a guide to the
Flash Players that work with different codecs (the year the Flash Player was
released is shown in parentheses):
• Sorenson Spark: Flash Player 6 (2002) and above. It’s the safest choice; if your
audience’s Flash Player is video-capable, this codec will work.
• On2 VP6: Flash Player 8 (2005) and above. This choice is pretty safe, unless
you’re sure that your audience has older computers. One advantage of this
codec is you can perform tricks like making part of the video image transparent, just like the news folks do when they put the weather guy in front of a map.
• F4V (H.264): Flash Player 9.2 (2008) and above. This choice produces the best
quality video using smaller file sizes. If you choose the F4V Flash video format,
it automatically uses the same H.264 codec that Apple uses for iTunes and
Apple TV.
Chapter 10: Incorporating Sound and Video
361
Incorporating Video
You can manually choose a codec from the Export Settings window of the Adobe
Media Encoder. Here are the steps:
1. In the Media Encoder, select Edit ➝ Export Settings.
The Export Settings window opens, as shown in Figure 10-10.
2. Click the Format tab, as shown in Figure 10-14.
If you don’t see tabs in the Export Settings window, click the Advanced/Simple
Mode toggle button, as shown in Figure 10-10.
Format tab
Figure 10-14:
Flash video uses two file formats. The FLV
format works with more Flash Players, but the
F4V format uses the latest, greatest technology
to create good looking video in small file sizes.
Video tab
FLV
F4V
3. Choose either FLV or F4V format.
If you choose the F4V format to take advantage of its good looks and small file
sizes, your job is done. The encoder uses the H.264 codec. If you choose the
FLV file format so you have compatibility with the older Flash Players out there,
then you need to go on to step 4 to specifically choose a codec.
4. If you’re using the FLV format, click the Video tab, and then select either
Sorenson Spark or On2 VP6.
The bullet points before these steps explain the advantages between these two
codecs. If you choose Sorenson Spark, you’re done. If you choose On2 VP6, you
can go on to the next step to choose whether or not to add an Alpha channel
(transparency) to your video.
362
Flash CS4: The Missing Manual
Incorporating Video
5. If you chose the On2 VP6 codec, you can click the Encode Alpha Channel
checkbox.
With an Alpha Channel encoded in your video, you have the ability to replace a
specific color with transparency. Called chroma-keying, this technique is common in newscasts and feature films.
Other Techniques for Reducing Video File Sizes
No one likes to wait while a Web page loads. So when you’re publishing video on
the Web, life is a constant quest to shrink the size of your video files so they’ll
travel the Net faster. In addition to the encoding tricks already mentioned, here are
some tips for shrinking those files while still providing a good video experience.
Some of these techniques are related to creating the video, and others are related to
Adobe Media Encoder and Export Settings.
Video techniques for reducing file sizes
• Start out with good quality video. When possible, use uncompressed video
before you encode to Flash Video. If your video has blips and glitches (called
noise by videographers) before you encode it, the video file ends up bigger.
• Avoid fancy effects and transitions. Special effects like fancy wipes or spiral
transitions don’t work as well in Flash video as a plain cut from one scene to the
next. Even dissolves add to the size of your video file.
Encoding techniques for reducing file sizes
• Reduce the dimensions of the video. It’s great to have a high-resolution video
that looks beautiful when the audience clicks the full-screen button. But if it
takes too long to download over the Internet, you won’t have an audience. As
described on page 357, you can change the dimensions of your video to reduce
the file size.
• Consider using a lower frame rate. You can set the frame rate in the Video tab
of the Export Settings window. The standard frame rate for American TV is
29.97 frames per second (don’t ask about the decimal; it’s a long story). The
standard for film is 24 fps. Test your videos at 18, 15, or even 12 fps to see
whether the quality/file size tradeoff is worth it.
• Use mono sound where possible. If your video is a musical performance, it may
be important to have stereo sound, but otherwise you can save precious file
space by clicking the Audio tab in the Export Settings window, and then choosing Mono.
• Use a lower bit rate for sounds that are mostly voices or don’t require highfidelity. Go to the Audio tab in Export Settings, and then use the drop-down
menu to reduce the bit rate for sound. The encoder has bit rates from 16 to 256.
A bit rate of 64 works for many Flash videos. You can go even lower if the
sound track is primarily voice, with no music.
Chapter 10: Incorporating Sound and Video
363
Incorporating Video
Preparing to Import Video Files
Before you can import a video clip into Flash, it’s good to know up front how you
expect to link the video file to your finished Flash animation file at runtime: by
embedding the video file directly into your Flash timeline, or by linking to the
video file at runtime, and so on.
This cart-before-the-horse consideration isn’t quite as odd as it seems at first
blush. Video files tend to be so huge you don’t usually want to embed them
directly into your Flash document the way you embed graphics and sound files
(page 319 and page 342, respectively). The process of setting up your Flash animation
and Flash video files for the public to view them is called deploying.
Note: Chapter 19 tells you all you need to know about publishing Flash files, including Flash files containing video clips.
Your deployment options include:
• Progressive download from a Web server. This option is one of the most popular
because all you need to publish video on the Internet is a regular, garden-variety Web server. Your Flash animation files (.swf) and Flash video files (.flv or .
f4v) are stored on the server. It’s called progressive because the video starts
playing for your visitors before the entire video file is downloaded. The downside to this option is the fact that the entire video is eventually stored on your
visitor’s computer, giving her the ability, if she’s clever, to make a copy of your
video. If you aren’t comfortable with bootleg copies, then consider one of the
next two options.
• Stream from Flash Video Streaming Service. This option is the most popular
way to show videos without letting others copy them. Basically, you hire a company to stream your video from their computers to your Web site visitors. Your
visitors never have a complete copy on their computers, making it more difficult for them to swipe it. You can find a long list of companies that provide this
service on Adobe’s Web site (www.adobe.com/products/flashmediaserver/fvss/).
These companies have a program called Flash Media Server on their computers, which detects the speed of your Web visitor’s Internet connection and
sends the video at a speed it can handle. Your visitor gets a higher-quality video
experience, and you get added security for copyrighted material. All you have to
do is pay for the service.
• Stream from Flash Media Server. This option is similar to the second option
above, except that you (or, more likely, your organization’s IT department) buy
the server hardware, install the server software, and maintain the resulting system. This option is best if you have deep pockets (Flash Media Server costs
$4,500) and don’t mind the hassle of maintaining a media server.
364
Flash CS4: The Missing Manual
Importing Video
Files
Note: If you have your own Web server and want to dip your toe in the Media Server water, you may
want to investigate Red5, an open source (free) Flash Server (http://osflash.org/red5).
• As mobile device video bundled in SWF. Use this option in combination with
Flash’s templates for consumer devices and handsets to create animations for
small handheld devices. This option is used to place video inside of SWF files
used with phones and handsets.
• Embed video in SWF and play in timeline. This option represents the simplest
way to embed video into your animation, but it only works for very short video
clips (somewhere between 5 and 10 seconds or less). Any more than that, and
the size of your animation file grows so large that you have trouble editing the
file in Flash and your audience has trouble viewing it in their Flash Player.
Importing Video Files
Once you have access to a video in the Flash Video format (.flv or .f4v), you’re
ready to begin importing the video file into Flash. When you begin this process,
your video can be on your computer or it can be on the Web, where it’s served up
by a Flash Media Server. In this section, you see step-by-step examples for both
scenarios.
Importing a Flash Video File Stored on Your Computer
When you have a video on your computer in one of Flash’s two video formats (.flv
or .f4v), it’s easy to import it into your Flash project. By making a couple of
choices along the way, you can give your Flash audience standard controls to play
and pause your video and adjust its sound. To work on the following exercise, you
can download the video building_implode.flv from the “Missing CD” page at http://
missingmanuals.com/cds.
Note: If you need to convert a video to one of the Flash video formats (.flv or .f4v), see page 352.
When you add video to your Flash project using this method, Flash creates a link
between the Flash file and your project. Even after you publish a Flash .swf file for
final distribution, the Flash file and your video file remain separate. If the project is
for a Web site, you need to place both the Flash .swf file and the video file (.flv or
.f4v) on the Web site, ideally in the same folder. To make things easy for yourself,
it’s best to put your Flash video in same folder where you save your Flash work file
(.fla) and publish your Flash animation (.swf).
1. Create a new Flash document, and then save it.
It’s always good to name and save your Flash projects at the beginning. It’s even
more helpful when you work with external video files as you do in this project.
A name like building_bye_bye.fla might be appropriate for this one.
Chapter 10: Incorporating Sound and Video
365
Importing Video
Files
2. Place the Flash video building_implode.flv in the same folder where you save
your Flash file (.fla) and your published flash file (.swf).
This step makes it easier for Flash to create a link to the video file. After publishing the .swf, as long as both files are located in the same folder, the link
between the two will continue to work.
3. In Flash, select File ➝ Import ➝ Import Video.
The Import Video dialog box appears, as shown in Figure 10-15, with several
options you can choose using radio buttons. The question is: Where is your
video file? Either it’s on your computer, or it’s stored on a Web server with
Flash Media Server software.
Figure 10-15:
The large Import Video
dialog box walks you
through adding video to
your Flash project. In the
first step, shown here,
you answer questions
about the location of the
video file and how you
want to use it in your
project.
4. Click the radio button for “On your computer.”
Flash wants to know where the file is right now, so it can load it into your
project. At this step, don’t jump ahead and start thinking about where the final project
is going to be published.
5. Click the Browse button, and then locate your video file.
Flash displays a standard Open window similar to the one you use to open a
Flash document. It should be easy to locate building_implode.flv, because it’s in
the same folder as your Flash file. After you select the file, its name and path
show up under the Browse button. Now that Flash knows where the file is
located, it can work with the video.
366
Flash CS4: The Missing Manual
Importing Video
Files
6. Tell Flash how you want to work with the video by clicking the radio button
labeled: “Load external video with playback component.”
• Load external video with playback component creates a link between your
Flash file and an external video file. When Flash gets a command to play the
video, it finds and plays the external file.
The other two options are used less frequently, but they’re useful for special
cases:
• Embed FLV in SWF and play in timeline. This option embeds video into
your animation. Each frame of video becomes a frame in the Flash timeline.
The result is the Flash file gets huge very fast, and your audience will be frustrated trying to download and play the video. Don’t try this option with clips
any larger than 5 or 10 seconds.
• Import as mobile device video bundled in SWF. Use this option in combination
with Flash’s templates for consumer devices and handsets to create animations
for small handheld devices (a topic not covered in this book).
7. Click Continue to move to the next Import Video step.
The Import Video box changes to show skinning options for your video. A skin
is a sort of container that adds play/pause/stop type controls to your video, as
shown in Figure 10-16.
Figure 10-16:
There are two basic types of skins for
Flash video. “Over” skins like the one
shown here sit on top of the video
image, hiding some parts of the
picture. “Under” skins are completely
outside of the image.
Pause
Captions
Stop
Rewind
Volume
Full Screen
Mute
Fast Forward
Chapter 10: Incorporating Sound and Video
367
Importing Video
Files
8. From the Skin drop-down box, choose SkinOverAll.swf.
Use the drop-down menu to choose an Adobe predesigned skin, as shown in
Figure 10-17. Adobe supplies a whole slew of skins with different combinations
of controls. SkinOverAll includes all of the controls, so this exercise shows you
what’s available. When you tackle a real-world project, you may find you don’t
need quite so many gadgets on your videos.
Figure 10-17:
Give your audience snazzy
video controls by simply
choosing from the Skin
drop-down menu. Use the
buttons in the lower-right
corner of the Import Video
dialog box to move forward
(Continue) or backward (Go
Back) in the Import Video
process. Or you can give up
entirely (Cancel).
There are also options to provide no controls at all (usually not the best option)
or to use a custom-designed skin. For example, you might want to put your client’s
logo on the video skin as another way to establish their brand.
9. Click Continue.
Flash displays the Import Video: Finish Video Import dialog box you see in
Figure 10-18. The details shown may not seem that important until it’s time to publish your Flash project on a Web page. Here’s a translation for each of the lines:
• The video you are using is located at: This line lists the folder where the
video file lives. If your final project is going on a Web server, you have to
give both building_implode.flv and building_bye_bye.swf to your Webmaster.
• The video will be located at: (relative paths are relative to your .swf) This
line explains the relationship of your files when you publish your Flash animation. It shows you the path that has to exist between the .swf and your
video file (building_implode.flv). In this case, there is no path (just a file
name) because you’re planning on keeping both the .swf and the .flv in the
same folder, whether it’s on your computer or a Web server.
368
Flash CS4: The Missing Manual
Importing Video
Files
Figure 10-18:
The last details displayed
in the Import Video
dialog box deal with the
location of files. This
information is helpful
when it’s time to publish
your Flash project on a
Web page.
• A Flash video component will be created on the stage and configured for
local playback. This line simply tells you that your video and whatever skin
you selected will appear on the stage in your Flash document.
• The video component uses a skin that has been copied next to your .fla.
This file will need to be deployed to your server. These sentences are a
roundabout way of saying that the skin for your video is stored in a separate .swf file. Flash places it in the same folder on your computer with
building_bye_bye.fla. This skin has a name similar to the name you choose in
step 8. In this case, it’s named SkinOverAll.swf, and it has to be in the same
folder with building_bye_bye.swf and building_implode.flv when you publish
your Flash animation.
• Before exporting and deploying your .swf you may need to… If building_
bye_bye.swf and building_implode.flv aren’t in the same folder when you put
your animation on a Web server, you need to change the path in the video
component. For more on video components, see the next section, page 371.
10. Click Finish.
The Import Video: Finish Video Import dialog box disappears. As promised,
you see the video on your stage along with the skin (video controls). There’s
also copy of the video in the Library, as shown in Figure 10-19.
Chapter 10: Incorporating Sound and Video
369
Importing Video
Files
Figure 10-19:
When you finish
importing your video to
Flash, it shows up in the
Library and there’s an
instance already placed
on the stage. If you need
another instance of the
video, say in another
scene, you can simply
drag it from the Library
to the stage in that scene.
11. Press Ctrl+Enter (c-Return on a Mac) to test your Flash project and view the
video.
In the Flash animation, you see your video running. Using the skin controls,
you can start and stop the playback.
Deploying your flash video on the Web
Most of the time, Flash projects that incorporate videos end up on the Web.
Whether you’re uploading the video to a Web page or someone’s doing it for you,
make sure that three files make the journey: the Flash animation (.swf), the Flash
video file (.flv or f4v), and the skin file (named something like SkinOverAll.swf).
Importing a Flash Video from the Web
Surprisingly, importing a video file that’s stored on the Web isn’t much different
from importing one that’s on your computer, as described on page 365. The Flash
video file may be in a standard Web server or one that has Flash Media Server software. (Don’t worry if you don’t have a video file stored on a Web server; there’s an
example file you can practice with, as you’ll see in the following steps.)
The only differences in the importing process happen at the very beginning.
1. Select File ➝ Import ➝ Import Video.
The Import Video: Select window appears.
370
Flash CS4: The Missing Manual
Importing Video
Files
2. Turn on the radio button next to “Already deployed to a web server, Flash
Video Streaming Service, or Flash Media Server” (Figure 10-15). In the URL
box, type the Web address where the file lives, and then click Continue.
The URL for the practice file is http://examples.oreilly.com/flashcs4mm/building_
implode.flv. When you click Continue, the Import Video: Skinning window you
see in Figure 10-17 appears.
The rest of the steps are identical to those for importing a Flash video file on your
own computer. You can pick up the process at step 8 on page 368.
Customizing the Video Playback Component
In Flash-speak, once your video is added to your Flash file, it’s called the FLVPlayback component. Components are prebuilt widgets that you drop into your animations. Someone else went to all the trouble of building (and hopefully testing)
the component. All you have to do is drop a component into your Flash project
and let it do its stuff. Components save you design and programming time, so it’s
worthwhile to learn about them. There’s a whole chapter on components
(Chapter 15), but since you’re already using one in this example, it’s worth covering some of the specific ways you can customize the FLVPlayback component.
Most components provide a few options that let you customize them for your
nefarious purposes. For example, in the case of the FLVPlayback component, you
can change the playback behavior of the video and the appearance of the video
controls. You can even change the video source file if you have a newly edited and
improved video. You change the settings for a component by changing its parameters. Here’s how to view and edit the FLVPlayback parameters:
1. In Flash, click the FLVPlayback component on the stage.
You don’t see many settings in the Properties panel for the FLVPlayback component. Instead, you use the Component Inspector to make most adjustments,
as described in the next step.
2. Select Window ➝ Component Inspector.
The Component Inspector panel opens in Flash. The name of each parameter
(setting) is listed on the left, and its value is shown on the right.
3. Make changes to the FLVPlayback parameters.
You can change multiple parameters without closing the Component Inspector. For example, to change the appearance of the skin (video playback controls), click skinAutoHide, and then set the value to true. To change the color of
the skin, click the skinBackgroundColor swatch, and then choose a new color
from the Color Picker.
Here’s a complete description of the parameters for the FLVPlayback component:
• align. Determines the alignment of the video image when the video scaleMode
(below) isn’t set to exactFit.
Chapter 10: Incorporating Sound and Video
371
Importing Video
Files
• autoPlay. If set to true, the video automatically plays when the Flash animation
frame that holds it is loaded.
• cuePoints. You can add cue points to your video when it’s encoded, as
explained on page 360. Or you can add them using the FLVPlayback component.
Click the magnifying glass to open a window where you can add manual cue
points by typing in a name and a time.
• islive. Used with a Flash Media Server, this value is set to true when streaming a
live performance.
• preview. Used for the live preview feature that helps you test the parameter settings. Click the magnifying glass to see your video with the current settings.
• scaleMode. This setting determines how the video image sizes itself after it’s
loaded. There are three options: noScale, where the video uses the size of the
Flash video source file; maintainAspectRatio, where the video retains its proportions when enlarged or shrunk; and exactFit, which forces the video to fit the
dimension of the component as shown in the Properties panel.
• skin. The name and path for the .swf file that adds playback controls to the
video.
• skinAutoHide. If set to true, the playback controls disappear unless the mouse
is hovering over the video image.
• skinBackgroundAlpha. Playback controls can be transparent. A value of 1.0 =
opaque and 0 = invisible. So, a value of .8 provides an 80% opacity effect.
• skinBackgroundColor. Click the color swatch, and then choose a new color
from the color picker.
• source. The name and path for the Flash video file.
• volume. Sets the audio volume for video playback. A value of 1.0 = full volume
and 0 = no volume. So a value of .5 provides half the available volume for audio
playback.
372
Flash CS4: The Missing Manual
Was this manual useful for you? yes no
Thank you for your participation!

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project

Download PDF

advertising