Chapter 5: Multimedia

macabretoothsomeΛογισμικό & κατασκευή λογ/κού

4 Ιουλ 2012 (πριν από 4 χρόνια και 11 μήνες)

282 εμφανίσεις

AIM Your Project with Flash: Chapter 5 - Multimedia
Chapter 5:
After completing this module, you’ll be able to:
• add sound to a project.
• add video to a project.
• add advanced visual elements to a project.

Developers can easily incorporate audio, video, and visual elements
into their Flash projects. These elements can be imported from a wide range
of other software tools. ActionScripts can then be used to control these ele
Flash developers shouldn’t view audio, video, and visual elements as
“extras” to be added as time permits. Instead, they should be considered
essential components of effective informational or instructional experi
ences. Each user has a different learning style and preferences for particular
presentation formats and styles. Rather than focusing projects on one type
of end user, provide a variety of resources, tools, and experiences to ad
dress the diversity of interests.
Using Sounds in Flash
From music to sound effects, there are many different ways to incor
porate audio elements into your Flash projects. You can play individual
sounds from the Timeline, synchronize sounds to animation, and loop
sounds so they play continuously.
Figure 5-A shows two examples of how Flash can be used in projects. In
the animated atlas example, the audio plays automatically along with the
project. In the Community Club example, users click a button to play the
AIM Your Project with Flash: Chapter 5 - Multimedia

Explore examples of sound in Flash.
How do the audio elements contribute to understanding? What unique
role do they play? What would happen if audio was not a part of
the project? What would be lost?
Figure 5-A. Animated Atlas -
Community Club -
Importing Sounds
There are two steps to using sounds in your project. First, import the
sound. Second, decide where and when it will play in your movie.
Although Flash contains many tools for integrating sound, there’s no
way to record audio in Flash. Instead, you’ll need to record your own
sounds with other software or locate existing audio files. Consider an open-
source audio recording and editing package such as Audacity.
Sounds can come from many sources. You can use public domain
sounds you locate on the web, sounds from clipart CDs, or sounds you
record yourself.
Developers can import sounds, sync sounds with animated sequences,
control volume, loop elements, and provide sound controls. Like graphics,
sounds can be imported with the Flash Library and used multiple times in
a project. As you explore sounds, you’ll notice that there are three charac
teristics that will impact quality: sample rate, bit rate, and channels.
Sample Rate
. Digital sounds are measured in kilohertz (kHz). Unless
you need super high quality, you don’t need more than 22 kHz.
Bit Rate.
Sometimes called bit resolution, 8-bit sound is fine for most
. Mono is one channel and stereo is two channels. Mono is fine
for most projects.
AIM Your Project with Flash: Chapter 5 - Multimedia
Sounds are imported into the Flash Library. Developers can import
*.wav, *.aiff, and *.mp3 audio file formats into Flash projects. You’ll have the
best luck with the *.mp3 format.
Let’s import a biplane sound into our airplane project.
To import a sound.
Click on the Stage or a keyframe in the Timeline.
Save the biplane found from the following website:
Pull down the File menu, choose Import, select
Import to Library.
A dialog box will appear.
Locate the sound you wish to import. Click
Open. In this case,
Nothing will change on the Stage, however
the sound file will be added to your Library.
Matching Sounds with Animation
Although there are many ways to sync sounds with animation, we’ll
start with a simple approach. This involves adding a sound to the Key
frame on the Timeline. This works the same in both ActionScript 2 and 3.
You’ll use the Properties panel to set the sound as
a sound, set effects, and customize.
event sound
is downloaded before it starts and plays until an event
stops it such as a mouse click or Timeline action. It may loop around and
play more than once to match the animation. Event sounds are often used
for roll-over buttons. It’s a good idea to use event sounds in most situations
unless you need to synchronize your animation.
start sound
is the same as event sound except they only play through
stop sound
is used to stop a sound from playing. For example, you
could turn off the background sound when narration begins.
stream sound
begins playing as soon as it begins downloading. It will
sync the sounds with the animations.
Explore digital audio resources found on the Internet.
Create a folder of sample audio clips to incorporate into your practice
Consider downloading trial software for recording or editing sounds.
AIM Your Project with Flash: Chapter 5 - Multimedia

Using the Edit Envelope you can also edit your sound including delet
ing parts of the sound. It’s also possible to adjust the left and right channels
to give a feeling of movement.
To insert a sound:
Create a new layer for your sound and call it
Select Frame 1 of the
You can insert the sound on any Keyframe
where you’d like the sound to begin playing.
In the Properties panel, choose Name and se
lect your audio file.
In the Properties panel, choose the Effect:
Fade left to right.
This effect moves the sound from the left
speaker to the right speaker so it sounds like it’s moving with the
Notice there are other choices your can make.
Pull down the Control menu, choose Test movie.
Adding Sound to Buttons
You may want to add sound to a button.
To add sounds to a button.
Create a button symbol.
Import a sound into your Library.
Double-click the button symbol to enter the Flash symbol editing
Click the New Layer icon to add a new layer.
Name the new layer,
Right-click or Control-click the Down frame and choose Insert Key
This will insert a Keyframe for your sound.
In the Properties panel, select your sound from the list. I can also set
the Effect to Fade from Left to Right, and set the Sync to Event.
AIM Your Project with Flash: Chapter 5 - Multimedia
Using ActionScript 2.0 with Sound
For most projects, use the properties panel to control the sound. How
ever for more complex project, you may need to use ActionScripts. In most
cases, you’ll use either use
. This method asks you to call an object from your Library
and create a internal link to the sound. These sounds are embedded in the
*.swf file.
. When using this method, you call an external sound file
that must be loaded into the movie. Keep in mind that this sound must
be available through the URL in order to work. This approach works best
when you access a file that you own and control.
The advantage of ActionScripts is that you have more control over the
sounds and can call what you need from the Library.
Once your sounds are imported, right-click on each one and select
Linkage. Select Export for ActionScript, click OK. Make sure that you give
your buttons instance names in the Property panel such as frog_btn. Once
you’ve provided linkage for all of the sounds and given instance names to
all of the buttons, you’re ready to write the ActionScript. Below are general
directions for trying the ActionScript approach to sounds:
To create an ActionScript for a sound:
Create a new layer called Actions.
Put the Actionscript in the frame where you want the sound to start.
croak_sound=new Sound();
//stop this and other sounds
//play croak_sound
You may want to experiment with different approaches to sound. In
some cases, you may want the end user to control the sound. At other
times, you want your sounds to match the action and timing of your proj
ect. For example if your sound plays longer than you wish, you may want
to stop it at a particular frame. To do this, select the frame immediately
after the place you want the sound to stop. Add a Keyframe, then open
ActionScript and place a “stopAllSounds” behavior.
stopAllSounds ( );
AIM Your Project with Flash: Chapter 5 - Multimedia

Using Video in Flash
Video is an exciting way to add movement and audio to your projects.
Flash can use many different video formats. You can use Flash to create
or import Flash Video (.flv) files. If you have QuickTime installed on your
computer, you can import files in *.avi, *.mpg, *.mov, and *.dv formats.
Short videos can easily be added to any Flash project. Try to keep video
down to about 10 seconds if you plan to play them off the web.
If you want longer videos, consider streaming video from the web.
Unfortunately, the videos will need to be served from a web server that
has this option. You can connect to an .flv video from your .swf file to play
video from a web server. This is a good idea if you have a long video be
cause it will start playing while it’s still downloading the file. You can also
stream video from a specialized Flash video server.
Figure 5-B shows an example of video in Flash projects. In the Apollo
11 project, the videos appear in a small video screen as part of the informa
tional aspect of the website.
Figure 5-B. Apollo 11 -
Explore how video is integrated into the following projects.
Notice the way users access and control the video clips. How could use
integrate video into a project?
Explore digital video resources found on the Internet.
For simple QuickTime movies, use Video & Image Starters Resource:
Create a folder of sample video clips to incorporate into your practice
AIM Your Project with Flash: Chapter 5 - Multimedia
Embedding Video in Flash
Before embedding video in a Flash project, you
need to be sure the video matches the Flash docu
ment in terms of the frame rate. Open the video in
any player software and “get info.” It will generally
show you the frame rate. Flash’s Import Video wiz
ard helps you deal with the complexities of matching
the video. You’ll need to convert your movie to the
FLV/F4V file format.
To convert your Flash document:
Place the video file in the folder with your Flash
Open the Adobe Media Encoder.
Click Add.
Locate the video file (such as .mov).
Choose Start Queue.
Your document will be converted to the F4V file
format and saved in your project folder.
To embed a video in a Flash project:
Click in the keyframe where you want your
video to play.
Pull down the File menu, choose Import,
select Import Video.
Choose On Your Computer button to import
your video.
Browse for the video.
Find and select a movie file and click Open.
Click Continue.
Choose the skin you’d like to use, click Con
Review the specifications, click Finish.
When the Flash video is ready, the movie
clip will appear in your Library!
They can be used just like any other
movie clip.
Use the Components Inspectors to see
the default specs.
Keep in mind that the video won’t play until it’s tested.
AIM Your Project with Flash: Chapter 5 - Multimedia

Using Behaviors in ActionScript 2.0
Behaviors are an easy way to control audio and video in your project,
but they are only available in ActionScript 2.0.
To control video using the Behaviors panel:
Add a movie clip to your Library
Pull down the Windows menu and choose the Behaviors panel.
Click the plus sign and choose Video.
Enter the website address and click OK.
The new event shows on the Behaviors list.
Figure 5-C. Screen 1 shows the project on the Stage. Screen 2 shows the project as a Test Movie.
AIM Your Project with Flash: Chapter 5 - Multimedia
Explore web resources for locating images:
Try a project using photos from nature:
Visual Elements
Much of the power of Flash comes from its ability to handle graphics. In
addition to animation, there are many interesting ways to enhance visual
elements. From mask layers to photo buttons, there are many interesting
ways to add visual elements into your projects. Like audio and video, you
can find many sources for clip art, photographs, and other images on the
Internet. Also consider scanned images and digital camera photos.
Masking Visuals
A mask layer hides all the objects on its related layers except those in
side a filled or text object. From peepholes to spotlights, you can use masks
to create some great effects. If you want to use text, be sure to use large,
block text for the best effect.
To create a masked visual:
Create a new project.
Name your layer something like
Put a photograph or other visual
on this layer.
Create a new layer called
This new layer will appear right above the layer where you just
put your photograph. If you have many layers, you need to adjust
them so the new mask layer is right above where you want your
Create or insert a filled shape, text, or instance of a symbol you want
to use on the new layer.
The filled part of the shape will be the “transparent” part of the
mask where you’ll be able to see through to the photograph.
Right-click or Control-click the layer’s name and choose Mask from
the pop-up list.
The layer will indent your
layer under your
layer and
lock both layers. Notice that the
layer is indent.
AIM Your Project with Flash: Chapter 5 - Multimedia

If you want to make a change in the photograph or the mask
shape, you’ll need to unlock the layer. Make the change. Then,
lock it again.
To create animated masked layers:
Unlock the mask layer.
Create a shape tween such as from a small circle to a large circle.
Or, add a movie clip to the mask layer!
Putting it All Together
Once your project is well-underway, consider how it works a whole.
Does your project load quickly? Is the project attractive and visually pleas
ing? Does it move at a fast pace without being overwhelming? Consider
sharing it with friends to see what they think of your work.
After a quick formative evaluation, make revisions and enhancements
that will make your project more professional. For example, you way want
to add a “preloader” to the beginning of your project.
Sometimes it takes a while to load a movie. Preloaders provide a visual
way for end users to see that your movie is loading and to remind them to
be patient. There are preloaders available for both ActionScript 2 & 3.
To add a preloader to your project using ActionScript 2.0:
Insert 5-10 frames at the very beginning of the timeline.
Create a preloader layer.
Create keyframes in the Actions layer.
On the first frame of the Action, add the following script:
ifFrameLoaded (“finalframenumber”) {
gotoAndPlay (“whateverframeIsYourFirstActualFrame”);
AIM Your Project with Flash: Chapter 5 - Multimedia
In a keyframe at the end of the 5-10 frames you added, place the fol
lowing action:
In the preloader layer, create a series of keyframes and input a
changing image or text. An example might be “Loading.” “Load
ing. .” “Loading . . .”
Look for other ways to enhance your project. For example, you might
add sounds, visuals, or web links. The key is develop an effective, efficient,
and appealing product that conveys your message.
AIM Your Project with Flash: Chapter 5 - Multimedia

Incorporate multimedia elements into a Flash project. Incorporate each of the following three
• Audio
• Video
• Visual (i.e., masking)
Save and upload both the .fla and .swf versions. In addition, write a short project plan to
describes the purpose and audience for your multimedia elements. In other words, your
project should serve a purpose.
The following criteria will be used in evaluating your activity:
• Required elements
• Project Plan
• Effective, efficient, and appealing project
AIM Your Project with Flash: