How to Use Flash MX Sound Objects

This document copyright 2007 by Kenny Bellew of Cowfly.Com Design, kennybellew@hotmail.com
NoteDO YOU HAVE A QUESTION?
Please read the following before asking a question. Read this please.
 

Do you want all of the flash files used to make this tutorial?

Please help support this website and the continuation of this project. If you would like to download a single ZIP file that contains all of the FLA's used to create this tutorial, please use the payment logo to donate $5.00 or more. I will reply with the URL that will allow you to download the ZIP file.
$5.00 for all FLA's used in the tutorial.
This tutorial will cover the following: Return to Index Do you want all FLA's used for this tutorial? Do you have a question?

Index:

Please consider hiring me to program your Flash job.  I'll provide a flat-rate quote for your Flash programming needs.
Note: I am currently over loaded with projects. I am not taking any new clients at this time. Watch this box for my availability. Thanks.
See my products page for details HERE.

I wrote the first version of this tutorial a couple of years ago. This update includes answers to some of the most commonly asked questions I have received regarding this tutorial since then. I will continue to update this tutorial on my website, Cowfly.com.

This tutorial is meant to build from information presented in one section to the next. To get the most from this tutorial, it should be read from beginning to end.  This tutorial will attempt to use ActionScript techniques that are familiar to the intermediate Flash programmer and that are easily grasped by the less experienced.

Introducing Sound Objects Return to Index Do you want all FLA's used for this tutorial? Do you have a question?

There are two main ways to control sound in Flash: Timeline sounds and Sound Objects. Timeline sounds are sounds that you embed in your timeline. When the play head reaches the sound, it plays. This is often acceptable for short sounds in a progressive storyboard type presentation. However, longer sounds will eventually lose synchronization with your timeline. You also cannot control the properties of the sound like you can with sound objects. Also, timeline sounds can bloat the size of your SWF.

Sound objects use either the attachSound or the loadSound method to incorporate sound into your movie. This will be explained in more detail shortly. The attachSound method has two parts: the object and the internally linked sound. When the object is called, it attaches the sound (which resides in the library) that was linked to the object when the sound object was defined. Sound objects that use the attachSound method are embed in the SWF.

Sound objects that use the loadSound method also have two parts: the object and the URL to the external sound to be loaded. When the object is called, the external sound loads into the movie. Sound objects that use the loadSound method can be loaded either as events or as streaming. Event sounds must load completely before they play, while streaming sounds begin to play as soon as enough data has loaded to start the sound.

Sound objects have methods, properties and event handlers. The following table lists these items.

Methods

  • attachSound()
  • getBytesLoaded()
  • getBytesTotal()
  • getPan()
  • getTransform()
  • getVolume()
  • loadSound()
  • setPan()
  • setTransform()
  • setVolume()
  • start()
  • stop()

Properties

  • duration
  • id3
  • position

Event Handlers

  • onID3
  • onLoad
  • onSoundComplete

 

Previous Next
BEGINNING How to Define a Sound Object Using the attachSound Method
Return to Index Do you want all FLA's used for this tutorial? Do you have a question?

This document copyright  2005, 2006 by Kenny Bellew of Cowfly.Com Design, kennybellew@hotmail.com