Home > Articles > Graphics & Web Design > Dreamweaver & Flash

  • Print
  • + Share This
This chapter is from the book

Using Sounds

Now that we've imported the sounds into our movie, we can explore how to make them play at the correct times. There's really only one place you can use sounds in Flash: in keyframes. (One exception is adding sounds dynamically with the advanced ActionScripting method for sound objects called attachSound.) If you want a sound to play whenever the user places his or her cursor over a button, you still need to place the sound in a keyframe—it's just a keyframe in the button. Attaching sounds to a button is a little more complex, and we'll cover that in depth in Hour 13, "Making Buttons for Your User to Click."

Now that we know sounds go in keyframes, we need a way to put them there. When you select a keyframe, the Properties panel provides a way to control what sounds play when you reach the selected keyframe. Flash provides other clues for you to "see" where sounds have been placed. For example, if your Timeline is long enough, you'll see a waveform for the sounds being used (as shown in Figure 10.3).

Figure 10.3 The waveform (the picture of the sound) is displayed in the Timeline. This will be helpful when you're trying to synchronize images with specific parts of your sound.

The Properties panel, however, is your best way to see which sounds have been added to which keyframe. But just like any other panel, the Properties panel displays only the sound used in the selected keyframe. Misreading this panel is very easy because it changes when you deselect keyframes. Figure 10.4 looks almost identical to Figure 10.3. However, in Figure 10.4, the Properties panel shows that no sound is being used. When you look closely at the Timeline, there's a waveform displayed but no keyframe selected. Therefore, it's necessary to look at the Properties panel after you've selected a particular keyframe.

Figure 10.4 The Properties panel can be confusing. It only displays (or lets you specify) sounds when a keyframe is currently selected. Here, the keyframe isn't currently selected, so the Properties panel displays nothing.

Sync Settings

After we have the Properties panel reflecting sound for the intended keyframe, we can decide exactly how the sound should play. The most fundamental choice you need to make for each use of a sound is its Sync settings. These control exactly how a particular instance of your sound will play—or, more specifically, the priority of the sound compared to the visual elements in your animation. Before you try them out, see the following list and Figure 10.5 for an explanation of each:

  • Event is the default setting and, generally, the best performance choice, especially for sound effects and other "incidental" sounds. When Event is chosen, sounds will start to play when the keyframe is reached and keep playing until they're done. Event sounds might not coincide with visual elements the same way on everyone's machine. Sounds won't play slower or faster (that would make them sound funny), but a machine with slower graphics performance may take longer to display visual elements. Suppose you have a one-second Event sound and your framerate is 12fps. You would expect that during the sound, 12 frames would be displayed, but a slow machine might only display six frames a second, in which case the sound would finish in one second, as you would expect, but after only six frames have been displayed.

  • Start is almost the same as Event, except that multiple instances of the same sound are prevented. With Event, a sound can be layered on top of itself, similar to singing a "round." Think of Start as playing a sound if it's not already playing.

  • Stop is kind of weird—it's for when you want a specified sound to stop playing. For example, if you import a sound called "background music" and by whatever means have it playing, when a keyframe is encountered with the same sound (background music) set to Stop, just that sound will stop. Any other sounds already playing will continue. This is a bit strange because you use the Properties panel to specify the sound (just like when you want the sound to play), but you're specifying it as the particular sound you want to stop. Think of Stop as "stop this sound if it's playing."

  • Stream causes the sound to remain perfectly synchronized with the timeline. Because, again, you can't have sounds playing slowly if the user's machine can't draw frames quickly enough, Flash will skip frames to keep up. Stream sounds start playing when the first frame is reached and continue to play as long as there is space in the timeline. In other words, if your sound is three seconds long and you're playing at 12fps, the timeline has to be at least 36 frames; otherwise, part of the sound will never be reached. The benefit of this setting is that synchronization will always be the same. If you place a graphic in frame 12, it will coincide perfectly with the first second of your sound. Just remember that when you're using Stream, you have to ensure there are enough frames in the Timeline to accommodate the length of the sound. Finally, Stream sounds are previewed as you "scrub," thus making the process of synchronizing audio to images possible.

Figure 10.5 For each instance of a sound, you must select a Sync setting (via the Properties panel).

The decision as to which Sync setting to use isn't terribly difficult. Event should be used for any short incidental sounds—such as rollover sounds. Actually, I suggest Event for all sounds that don't require critical synchronization. Background music that just plays and loops won't need to be synchronized. Therefore, you should use Event. Start is a perfectly good alternative to Event and will simply prevent the layering of the same sound. For example, suppose you have a row of five buttons. If each button has the same rollover sound and the user quickly moves across all five, an Event sound will play once for each button. If the sounds are short enough, this is probably appropriate. However, if the sounds are quite long, they would become discordant. If you use the Start sync setting, only one instance of the sound would play at a time, regardless of how fast the user moves his or her mouse. Event can be a better choice than Start when a little bit of overlap is okay. Consider a "ding" sound every time a ball bounces on the ground. If you choose Event the ball can bounce a second time and even if the first sound isn't totally finished, it will play again. In any event, Start and Event are good for the majority of sounds you'll play.

Rollover sound is a sound effect that plays any time a user places his or her cursor over a button. You'll learn about this later in Hour 13.

The Stop sync setting is very powerful. It gives you a way to stop specific sounds. Using this method can be a little tricky because it will only stop one sound per keyframe. When you learn about Actions (as you will in Hour 14, "Using ActionScript to Create Non-Linear Movies"), you can insert the "Stop All Sounds" Action to stop all sounds at once. Depending on the situation, this may be appropriate. If you're giving the user the ability to get several sounds going at once, you'll want to learn Stop All Sounds. However, suppose you have one sound playing in the background, and when a tween starts you want a special sound effect to play (and keep playing) until the tween ends. You can put the background sound in an early keyframe and then, in the first keyframe of the tween, place the sound effect and set its sync to Event or Start. In the last frame of the tween, you can put the same sound effect but set the sync settings to Stop. This way, the sound effect will stop at the end of the tween, but the background sound will continue.

Finally, Stream is good for one thing: synchronizing graphics with sound. This is especially useful for character animation where you want a character's lips to synchronize with its voice. When trying to synchronize sounds with images, use the "scrub" technique mentioned earlier, but now with Stream sounds you'll hear the sound as you scrub. Because Stream sounds effectively lock themselves to the Timeline, you probably don't want to change the movie's framerate. For example, a three-second sound will take 36 frames at 12fps. If you do some work and then change the framerate to 24fps, the same three-second sound spans 72 frames! Flash automatically spreads the Stream sound out so that it takes three seconds when you change the framerate, but Flash won't change your graphics, which will now play in 1.5 seconds. See Figure 10.6 for a before-and-after example of changing the framerate after an animation is built.

In spite of this issue, you should stick with a framerate (which, really, isn't anything new—it comes up even if you don't use sounds). Stream sounds remain pretty appealing. However, you should realize that frames will be skipped to make sure the sound stays synchronized. Naturally, this only happens to users on slower-performing machines. It's just that often it's more important that every frame of your animation appears even if it means the sounds may drift out of synchronization. My point is that you should only use Stream when the synchronization is critical (and you don't mind dropping frames). Otherwise, use Event or Start.

Figure 10.6 The same animation and sound with frame- rates of 18fps (top) and 6fps (bottom). Notice that keyframes and tweening are not affected, but the sound needs to take more room when the Timeline is only advancing six frames per second (the audio can't expand or contract because that would sound funny).

Effect Settings

The Properties panel provides some pretty fancy effects you can apply to a selected sound. In the drop-down list next to Effect, you'll find effects such as Fade In and Fade Out as well as Fade from Left to Right and Fade from Right to Left. In order to understand and customize these settings further, you can either select Custom from the list or click the Edit... button on the Properties panel to access the Edit Envelope dialog box, as shown in Figure 10.7.

Figure 10.7 The Edit Envelope dialog box lets you select from pre-built panning effects or create your own.

  • Left Channel/Right Channel will display different wave forms if your original sound was stereo. Even if you only use mono sounds, you'll get the left and right channels so that you can still create panning effects. In the case of mono, the same sounds will come out of each speaker—you'll just be able to modify the volume of each.

  • Envelope lines indicate the volume level at any particular time in the sound. When the line is at the top, the sound plays at full 100% volume. (Some audio tools are different because they use the middle to indicate 100% and anything higher to indicate amplified or boosted sound, but this is not the case in Flash.) If the envelope line is getting higher as you move to the right, the volume will increase.

  • Envelope handles are like keyframes within the sound. If you want the envelope lines (indicating volume) to change direction, you'll need to insert a handle, which acts almost like a keyframe for sound. All you need to do is click anywhere on a line and a handle will be inserted. No matter which channel you click, a matching handle is placed in the other channel. A handle in one channel must match the moment in time (left to right) of the handle in the other channel. However, the volume (height) can vary between the two.

  • Time In lets you establish the starting point of a sound. You're effectively trimming the extra sound (or silence) at the beginning of the sound file. You're not telling the sound to start any later, but the sound you hear will begin wherever the Time In marker is placed.

  • Time Out lets you trim extra sound off the end of a sound file. Often you'll see a moment of silence at the end of a sound file, and even if you don't hear anything, it still adds to the file size! You can get rid of it by moving the Time Out marker to the left. You won't actually destroy the source sound in your Library, but when you export the movie, the unused portions of the sound won't be used (so your file stays small).

  • Stop/Play lets you preview all the settings you've made. This is important because although the waveform can let you "see" a sound, you ultimately want to judge the effect with your ears.

  • Zoom In/Out lets you zoom out so the entire sound fits in the current window or zoom in for a close up to control precisely how you place the Time In/Out markers or envelope handles.

  • Display units (Time or Frames) simply changes the units displayed (in the center portion) from time units (seconds) to frame units. Time is not as useful when you want to match your sound to a particular frame (where something visual occurs). If the display shows a peak in the music at 1 second, you have to use framerate to calculate exactly which frame that translates to. With the display set to Frames, Flash will do the calculations for you.

Panning is an effect that makes sound seem to move from left to right or right to left. It's simply a trick in which the volume for one channel (left or right) is increased while the volume for the other channel is decreased. When combined with a graphic moving in the same direction, this technique can be very effective. Imagine, for example, a car moving across the screen at the same time the audio pans in the same direction.

Despite all the details in the Edit Envelope dialog box, you really only have two basic ways to use it: You can either use a preset effect or make your own. Actually, you can start with a preset (such as Fade In) and then make modifications to it, essentially making a custom effect based on a preset. Use the effects in any way you think appropriate. Listen to the effect after each change by clicking the Play button. Nothing you do here will affect the master sound in your Library. You can actually use the same sound several times throughout your movie, with different effects in each instance.

One of the most important things to remember is that the Time In and Time Out markers can save file size. Only the sounds and portions of sounds actually used will be exported when you publish your movie. Unused sounds in the Library and portions trimmed from the beginning or end of a sound will not be exported. Trimming a few seconds off the end of a sound can mean many seconds (even minutes) saved in download time for your users. Also, changing the volume of a sound has no impact on file size, so setting the envelope lines to the lowest level makes no sense.

Loop Settings

Finally, note the Properties panel has a field where you specify the number of loops a particular sound should play. This simply makes the sound repeat the specified number of times without any pauses. This is great for sounds that loop well.

Some sounds loop better than others. Basically, a sound that loops well ends the same way it starts. There's an art to making sounds loop. Although importing a large song and using the Time In and Time Out markers to establish a nice looping sound is possible, it won't be easy. More likely, you'll have to find a sound already prepared by an audio engineer. A professionally prepared sound can loop so seamlessly that you can listen to it and not even notice it's looping; it will just sound like it's endless.

Also, if you have a sound that you want to loop "forever" (and you're satisfied with its loop quality), the standard and recommended practice in Flash is to just put a very large number into the Loop field. Although it seems strange, that's how you do it. If you type 99999999999, Flash changes this entry to 2147483647. I suppose a very patient viewer could outlast the total number of loops, but consider that a one-second sound repeated 2,147,483,647 times takes 68 years to finish!


By the way, creating loops and even songs built from many separate loops isn't all that difficult. Tools such as Sonic Foundry's Sound Forge and Acid Pro give you all the tools necessary to create and assemble loops. These are professional tools that go beyond the needs of average Flash users—but you'll probably be surprised how easy you can create music. Like Flash, you can try Sound Forge and Acid Pro free.

  • + Share This
  • 🔖 Save To Your Account

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information

To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.


Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.


If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information

Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.


This site is not directed to children under the age of 13.


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information

If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information

Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents

California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure

Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact

Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice

We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020