Go Ronald — Flash Tutorial Sound
Posted on September 5th, 2008 | No Comments »Categories: Flash Industry News, Uncategorized
In this tutorial you will learn how to add sound to your Flash Movie. This tutorial explains how to Import sound files into your Flash movie and then looks at the two different ways in which Flash handles sound: Event and Streamed sound. There is an explanation of both sound types and practical instructions of how to use each of these in your Flash Movies.
Importing Sound into your Flash Movie
Common Library
Flash comes with a small Library of sounds that you can use. They are the type of sounds that you would attach to a button so that when the button is clicked you also hear a “click”. To access the sounds:
Go to: Window > Common Libraries > Sounds
This opens a panel with a list of sounds:

Common Sound Library
To Listen to the sounds:
- Select the sound name in the lower section.
- Click the play button
in the top section.
There are a number of ways to get a sound from the common Library into your Movie.
- Open your own Library: Window > Library
- Move the Libraries so that they are one next to the other.
- Drag a file from the Common Library to your Movie Library

A sound file in the movie Library after it has been dragged from one library into the other.
Note: You cannot use the sound unless it is in your own movie Library.
Another way of getting a sound file into your movie is to drag it from the Common Library directly onto the Stage. Even though you drag onto the Stage you will find the sound in the time line!
![]()
A sound which has been dragged onto the Stage ends up in the TImeline.
Note: Once you dragged a sound onto the Stage you will find that it is in your own movie library. It will stay in your library even if you remove the sound from the timeline.
Importing an External Sound File
You cannot import any sound, it can only be certain file formats:
- WAV (Windows only)
- AIFF (Macintosh only)
- MP3 (Windows or Macintosh)
If QuickTime 4 (or later) is installed on your system, you can also import these:
- AIFF (Windows or Macintosh)
- Sound Designer II (Macintosh only)
- Sound Only QuickTime Movies (Windows or Macintosh)
- Sun AU (Windows or Macintosh)
- System 7 Sounds (Macintosh only)
- WAV (Windows or Macintosh)
To import a sound file into Flash go to either:
File > Import or
File > Import to LibraryBrowse to where your file is located.
Select a file and click: Open
It does not matter which Import method you use as either way the file ends up in your library.
Event or Streamed Sound
Event
An event sound is one which plays to the end of the sound file no matter what else is happening in your Flash movie. That means that once it starts to play it cannot be turned off! For this reason event sounds are usually short. The most common use for an event sound is to attach it to a button. When you click the button it makes a sound - it”s a bit like a door bell except it is a button bell.
An event sound must be downloaded before it will play. This is important because sound files can be very large. This is another reason why event sounds tend to be short. Remember that once a particular sound has been used once, it can be used again and again without having to re-download. Therefore it is better (in download terms) to have a few sounds attached to many buttons than every button have it”s own unique sound.
If somebody clicks on a button that has a sound attached and the sound has not yet downloaded the button will still work. It will just be silent.
Streamed
Streamed sound does not need to be downloaded to play. It downloads and plays simultaneously. If you have sounds that are more than a few seconds long you should used streamed sound. The disadvantage is that on a slow Internet connection the sound/music may be of poor quality. You either have to make sure that the sound is not played until the entire file has downloaded or accept that the quality may not brilliant on all machines.
Cross Ref: One way to ensure that a sound file has completely downloaded is to use a preloader. See tutorial: Intermediate - Preloader
Steamed sound can also be switched on and off. All sounds go in the Timeline but a streamed sound can only be heard if the Timeline is being played. If you stop the movie from being played, the sound will stop. Also if you go to a different section of the movie, like a new scene, the sound will also stop playing.
Step One: Setting up the Document
- Go to: File > New
- Go to: Modify > Document
- Select a size for the Movie.
Mine is: 95 x 35 pixels - Go to: File > Import to Library
Select the sound file that you want to use.
If you have downloaded the sound file above import: Beg-021c__Sound.mp3Note:
On some computers you will not see the file extension (.mp3) at the end of the file name.
Step Two: Creating the Streamed Sound
- In the Timeline re-name Layer 1 to: Audio
- Right click (Mac Ctrl click) on Frame 1 and from the menu select: Actions
- Go to: Plus
> Actions > Movie Control > stop
This will place the following ActionScript in frame 1:
stop();
This is to make sure that the sound file does not auto-play. - Right click on frame 2 and select: Insert Blank Keyframe
Audio Layer in the Timeline with Action and 2 blank Keyframes.
- If the Property Inspector is closed - open it: Window > Properties
- Click in Frame 2 to select it.
- In the Property Inspector select: Sound > Beg-021c__Sound.mp3
Or what every your sound file is called. - In the Property Inspector select: Sync > Stream
The sound setting for frame 2.
Note:
The sound file starts in frame 2 so that when the movie first loads and when you press the stop button the movie will be totally silent. - For streamed sound to play you need to have enough frames in the timeline.
If you are using the sound file downloaded from this site, right click on frame 161 and select: Insert Frame
If you are using a different sound file you will need to keep adding frames until the Timeline is long enough.
You can see the end of the sound file when the horizontal line stops.
The sound only starts in frame 2.
The entire length of the Timeline.Tip: If you need to keep adding frames use the F5 key. If you have too many frames and need to remove some use: Shift F5
Step Three: The Control Buttons
We need three buttons for Play, Pause and Stop. There is no reason why you cannot create your own buttons, but for this tutorial I am going to use three buttons that are in the Common Library as it is quicker and easier.
- Create a new Layer by clicking on the Insert Layer button in the Timeline:
- Name the layer: Buttons
- Go to: Window > Common Libraries > Buttons
- Double click on the folder
: Playback
- Drag on Stage the following buttons:
Gel Right:
Gel Pause:
Gel Stop:
Right Click (Mac: Ctrl click) on the Gel Right Button and select: Actions
- Click on the View Options button
and select: Normal Mode
- Go to: Plus
> Actions > Movie Control > Play
Your ActionScript should look like this:on (release) {
play();
}
Right Click on the Gel Pause Button and select: Actions
- Go to: Plus
> Actions > Movie Control > Stop
Your Action Script should look like this:on (release) {
stop();
}
Right Click on the Gel Stop Button and select: Actions
- Go to: Plus
> Actions > Movie Control > goto
- In the Options select the Radio button
: Go to and Stop
Your Action Script should look like this:on (release) {
gotoAndStop(1);
} - Your movie should now be ready to rock and roll. Test your movie: Control > Test Movie
Cross Ref: Sound files can make a Flash movie very large and means that the file maybe slow to download. To look at how you help keep your file sizes small, including sound compression see tutorial: Beginners - Optimizing a Flash Movie












