Sound Tutorial

Home Food Mates • Members Tutorials Forum Buy Templates Contact Us 

 


Flash Tutorials

   

Flash - Sound

 

Free Flash Tutorial

 

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:

  1. Select the sound name in the lower section.
  2. 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.

  1. Open your own Library: Window > Library
  2. Move the Libraries so that they are one next to the other.
  3. 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:

If QuickTime 4 (or later) is installed on your system, you can also import these:

To import a sound file into Flash go to either:

File > Import or
File > Import to Library

Browse 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.

 

 

Attaching an Event Sound to a Button

 

Example: Download the Flash file Beg 021a

 


Click the button to hear the Event sound.

  1. Open a new Flash file.
  2. Set up the size of the document by going to: Modify > Document
    The size of my file is: 100 x 30
  3. Place a button on the stage. You can either make your own button or...
    Drag a button out of the common Library: Window > Common Libraries > Buttons

    Note:
    If you take a button from the Common Button Library avoid Knobs, Faders and Component buttons as they work differently.

    Cross Ref: If you want to learn how to make buttons see tutorial: Beginners - Buttons
  4. When you have a button on Stage right click (Mac Ctrl click) and from the menu select: Edit
  5. In the Timeline click on the Insert Layer button:
  6. Name the layer: Sound

    Note:
    Adobe recommend that sound is always placed in its own layer.


    Editing the Button: Creating a new Layer for the sound.
  7. In the Sound layer right click in the Down frame and select: Insert Blank Keyframe


    Blank Key Frame in the Sound layer, located in the Down Frame.
  8. Open the Sound Library: Window > Common Libraries > Sounds
  9. With the Sound layer - Down Frame still selected drag one of the sounds onto the Stage. I selected: Beam Scan


    The sound is now in the frame.

    Note:
    Even though you drag the sound onto the Stage the ends up in the Timeline. You can now see a horizontal line going through the Down Frame. This is a graphic representation of the sound.
  10. Open the Property Inspector: Window > Properties
  11. As long as the same Frame is still selected you should see a settings for sound. Under Sync it should say: Event
    If it does not say Event use the drop down menu to select: Event


    The sound settings are towards the right of the Property Inspector.

    Note:
    You can only see Sync if the Property Inspector is in expanded view. If you cannot see the Sync setting click on the expand button in the bottom right corner.

    Note:
    If you want to remove the sound, select None from the drop down arrow where is says - Sound: Beam Scan.
  12. Your button is now ready to test: Control > Test Movie

 

Attaching a Streamed Sound to the Timeline

 

Example: Download the Flash file Beg 021b

 


Use the controls to Play, Pause and Stop the Streamed sound.

Credits: This sample file was submitted by Buffalo Audio: A site offering professional voice-over narration and custom music/sound effects.

Example: Download the MP3 Sound file Beg 021c

To create a streamed sound in a Flash movie you will need a sound file. Although it is possible to use one of the sounds in the Common Sound Library, they are all very short, which is not very good for streamed sounds. If they are too short it makes it hard to test the movie. You can either download the MP3 file (Beg 021c) or use your own sound file. It can be any of the formats listed above.

 

Step One: Setting up the Document

  1. Go to: File > New
  2. Go to: Modify > Document
  3. Select a size for the Movie.
    Mine is: 95 x 35 pixels
  4. 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.mp3

    Note:
    On some computers you will not see the file extension (.mp3) at the end of the file name.

Step Two: Creating the Streamed Sound

  1. In the Timeline re-name Layer 1 to: Audio
  2. Right click (Mac Ctrl click) on Frame 1 and from the menu select: Actions
  3. 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.
  4. Right click on frame 2 and select: Insert Blank Keyframe


    Audio Layer in the Timeline with Action and 2 blank Keyframes.
  5. If the Property Inspector is closed - open it: Window > Properties
  6. Click in Frame 2 to select it.
  7. In the Property Inspector select: Sound > Beg-021c__Sound.mp3
    Or what every your sound file is called.
  8. 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.
  9. 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.

  1. Create a new Layer by clicking on the Insert Layer button in the Timeline:
  2. Name the layer: Buttons
  3. Go to: Window > Common Libraries > Buttons
  4. Double click on the folder : Playback
  5. Drag on Stage the following buttons:

    Gel Right:
    Gel Pause:
    Gel Stop:



  6. Right Click (Mac: Ctrl click) on the Gel Right Button and select: Actions
  7. Click on the View Options button and select: Normal Mode
  8. Go to: Plus > Actions > Movie Control > Play

    Your ActionScript should look like this:

        on (release) {
            
    play();
        }

  9. Right Click on the Gel Pause Button and select: Actions
  10. Go to: Plus > Actions > Movie Control > Stop

    Your Action Script should look like this:

        on (release) {
            
    stop();
        }

  11. Right Click on the Gel Stop Button and select: Actions
  12. Go to: Plus > Actions > Movie Control > goto
  13. In the Options select the Radio button : Go to and Stop

    Your Action Script should look like this:

        on (release) {
            
    gotoAndStop(1);
        }

  14. 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

 

Please indicate what you thought of this tutorial 
10 is the best: 
10 9 8 7 6 5 4 3 2 1


Webwasp Community: Webwasp Mates & Dates

Why not try out webwasp's new community. Meet new people, find friends in your area: Webwasp Mates & Dates

98762 visitors to this page since Jan 04

 Top of Page Home Food Mates Members Tutorials Forum Buy Templates Contact Us 
 All material on this site is protected under international copyright © law. DO NOT reproduce any material from this site without written permission. Please ask as permission is often granted.