Upload
buck-berry
View
217
Download
0
Embed Size (px)
DESCRIPTION
Add Sound and Video Introduction –Sound and video are important tools you can use to express a message, engage users, and make your site or application appealing to visitors –Sound and video can add significantly to the size of movies that you publish
Citation preview
© 2011 Delmar, Cengage Learning
Chapter 11
Adding Sound and Video
Chapter 11 Lessons
1. Work with sound2. Specify synchronization options3. Modify sounds4. Use ActionScript with sound5. Work with video
© 2011 Delmar Cengage Learning
© 2011 Delmar Cengage Learning
Add Sound and Video
• Introduction– Sound and video are important tools you can
use to express a message, engage users, and make your site or application appealing to visitors
– Sound and video can add significantly to the size of movies that you publish
© 2011 Delmar Cengage Learning
Add Sound and Video
• Introduction– You should only apply sound and video
where it will have the most impact– Flash provides a number of compression
options that can help you achieve a balance between quality and file size
© 2011 Delmar Cengage Learning
Tools You’ll Use
Adding Sound and Video
© 2011 Delmar Cengage Learning
Work with Sound
• You can add sound to an object or the Timeline in Flash by importing sound files to the Library panel.
• Flash also provides you with dozens of sound effects found in the Common Libraries panel on the Window menu.
• You can use ActionScript to add sound during runtime.
© 2011 Delmar Cengage Learning
Work with Sound
• When you want a sound to play in the background, rather than tie it to a specific object on the Stage, you can add an instance of the sound to a frame on the Timeline.
• It is recommended that you use the Properties panel to add instances.
© 2011 Delmar Cengage Learning
Work with Sound
• The approximate duration of the sound is indicated by the number of frames the lines occupy.
• If the sound is longer in duration than the movie in seconds, the sound may continue playing after the playhead has reached the last frame.
© 2011 Delmar Cengage Learning
Work with Sound
A sound on the Timeline
This layer contains the sound Sound file on Timeline
• Sounds are represented on the Timeline by either a straight or waveform line.
© 2011 Delmar Cengage Learning
Work with Sound
• You can play multiple sounds at once by placing the sounds on different layers.
• Sounds you add in Flash are considered event sounds.
• The sound starts in the keyframe to which you add it, but it can continue playing even after the last frame in the main Timeline is played.
© 2011 Delmar Cengage Learning
Work with Sound
Sounds in Timeline extend to end of movie
© 2011 Delmar Cengage Learning
Work with Sound
• You can have event sounds play at a faster or slower rate than indicated by the frames on the Timeline.
• You can use event sounds as many times as you like in a movie, with no increase in the file size.
© 2011 Delmar Cengage Learning
Work with Sound
• Stream sounds are similar to animated graphic symbols because they are closely tied to the main Timeline.
• Stream files will begin playing right away without the user having to wait for the entire sound file to download.
© 2011 Delmar Cengage Learning
Specify Synchronization Options
Synchronization options:• Start• Stop• Stream
The Sync sound options in the Properties panel
© 2011 Delmar Cengage Learning
Specify Synchronization Options
• Stream sounds are tied to the Timeline and the number of frames on the Timeline.
• When you add a sound and set it to be stream, Flash breaks the sound into individual sound clips and then associates each clip with a specific frame on the Timeline.
© 2011 Delmar Cengage Learning
Specify Synchronization Options
• If the sound is longer than the number of frames on the Timeline, the sound still stops at the end of the movie.
• An important use of stream sounds is for you to be able to synchronize animation and audio.
© 2011 Delmar Cengage Learning
Specify Synchronization Options
• A Start sound is similar to an event sound, but it will not play again if an instance of that sound is already playing.
• You can use the Start option with sounds associated with buttons or with movies that loop back to the beginning, in order to avoid overlapping sounds.
© 2011 Delmar Cengage Learning
Specify Synchronization Options
• The Stop option lets you end an event sound at a specific keyframe.
• You can insert a keyframe in the frame where you want to apply a Stop option, then you specify the name of the sound you want to stop in the Properties panel.
© 2011 Delmar Cengage Learning
Specify Synchronization Options
A Stop option on the Timeline and in the Properties panel
The block rectangle indicates the end of the span of frames with the same content
The filled-in blue square above the keyframe indicates a stop action
© 2011 Delmar Cengage Learning
Modify Sounds
• In most cases, you will want to edit and enhance sounds in a sound-editing program before you import them into Flash.
• However, Flash does include some basic editing features you can use on sounds you have already imported.
© 2011 Delmar Cengage Learning
Modify Sounds
The Edit Envelope dialog box
Envelope handle for left channel
Sound line for left channel
Envelope handle for right channel
Sound line for right channel
Time In control
Time Out control
Units in frames
Display units in frames
Display units in seconds
Zoom outZoom inPlay soundStop sound
© 2011 Delmar Cengage Learning
Modify Sounds
• You can trim the length of a sound file using the Edit Envelope dialog box.
• You can preview the edits you make to a sound by clicking the Play button at the bottom-left corner of the Edit Envelope dialog box.
© 2011 Delmar Cengage Learning
Modify Sounds
• Flash includes the following effects you can apply to sounds:– Left Channel plays the sound only in the left
channel or speaker– Right Channel plays the sound only in the
right channel or speaker– Fade Left or Right gradually shifts the sound
from the left channel to the right channel over the duration of the sound
© 2011 Delmar Cengage Learning
Modify Sounds
• Effects Continued…– Fade Right to Left gradually shifts the
sound from the right channel to the left channel over the duration of the sound
– Fade in increases the volume of the sound as it begins to play
– Fade out decreases the volume of the sound as it ends
© 2011 Delmar Cengage Learning
Modify Sounds
• You can set these options either in the Properties panel of the frame to which you have added the sound or in the Edit Envelope dialog box for the sound.
• Custom lets you create your own volume variations over the duration of a sound.
© 2011 Delmar Cengage Learning
Modify Sounds
A custom volume envelope
Sound increases in volume here
Sound decreases in volume here
© 2011 Delmar Cengage Learning
• You can use actions to set how and when sounds play in a movie, and to start or stop sounds in response to user interactions.
• To reference a sound from the Library panel in ActionScript, you must enable the Export for ActionScript option.
Modify Sounds
© 2011 Delmar Cengage Learning
Modify Sounds
Click check box to allow sound file to be used in ActionScript
Class name used for linkage
© 2011 Delmar Cengage Learning
Use ActionScript with Sound
• A sound object is a way for ActionScript to recognize and control a sound.
• When you create a sound object it is similar to creating an instance of a sound on the Stage, except it happens entirely in ActionScript.
© 2011 Delmar Cengage Learning
Use ActionScript with Sound
• The Sound.play method starts a sound playing.
• Sound.play includes optional parameters that let you specify a sound offset and also the number of times to repeat the sound.
• The stopAll method of the SoundMixer class stops all sounds currently playing.
© 2011 Delmar Cengage Learning
Use ActionScript with Sound
Example of ActionScript to create a sound object
A variable (named snd)with a sound data type;the sound data type isidentified by using theclass name (myMusic)that was specified in theLinkage area of the SoundProperties dialog box
Assign an instance of thesound class to the variable
© 2011 Delmar Cengage Learning
Work with Video
• Progressive downloading uses a video Component and ActionScript to load an external FLV file into a SWF file, allowing the video to play when the SWF file is played.
• This keeps the SWF file smaller than when the video is embedded.
© 2011 Delmar Cengage Learning
Work with Video
• The process to load an external video:– Start a Flash ActionScript 3.0 document and select
the layer and frame where the video will be displayed– Import the video using the Import Video option from
the Import command on the File menu– Use the Browse button in the Import Video dialog box
to navigate to the folder where the video is located and choose video
© 2011 Delmar Cengage Learning
Work with Video
• Process Continued…– Check the Load External video with playback
component option, and then click the Next button– The Skinning screen appears. The video’s skin
determines the appearance and position of the video controls
– The Finish Video Import screen appears, indicating the file and its location as well as information on the video component and its skin
© 2011 Delmar Cengage Learning
Work with Video
The Skinning screen in the Import Video dialog box
Preview of the selected skin
Click to view Skin options
Click to view color palette of available control bar colors
© 2011 Delmar Cengage Learning
Work with Video
• Cue points are indicators on the video Timeline that you specify.
• To create a cue point, you scrub the seek bar to locate the desired position for the cue points, then you use the CUE POINTS area of the Properties panel to add a cue point and give it a name.
© 2011 Delmar Cengage Learning
Work with Video
Setting a cue point
Seek bar scrubbed to the 13 secondpoint on the video timeline
Cue point named lion is created at the 13 second point