First time here? First time here? Newsletter Signup Newsletter
Login | Register | 651326 Members and growing!
Search tutorials
Author: Kenny Bellew | Website:

How to Control All Sounds Globally

globalSound = new Sound();

If the above example is placed on frame one of the _root timeline, anything you do to that sound object will happen to all others, regardless of how they are defined, where they are defined or to which movie clip they are associated. There is nothing magical about the name of the sound object. You can call it what you like. The key is that it is not associated with any specific movie clip, therefore it affects the _root timeline and any sound object added or nested into the _root timeline.

Creating a global sound object will also affect non-sound object audio. For example, you could control the volume of an imported video using the global sound object. Understanding this would allow you to raise, lower or mute the volume at specific locations in the video - effectively providing a way to edit the audio. Controlling volume is described in the next section.

firstSound = new Sound(firstSoundMc);
secondSound = new Sound();

As in the above example, one sound object was defined on the _root timeline as being assigned as a child of the movie clip "firstSoundMc". The other, secondSound, was not assigned to any movie clip. Note how these two sounds are stopped in the following example:

For firstSound:

on(press) {

For secondSound:

on(press) {

They are stopped exactly in the same manner. However, because "firstSound" was assigned to be the child of the movie clip "firstSoundMc", the stop call to the "firstSound" sound object only stops sounds associated with the movie clip "firstSoundMc". All other sounds continue.

On the other hand, by pressing the stop button for "secondSound", which was not assigned to a movie clip, it will stop all sounds, including sounds assigned to a specific movie clip. This can be convenient if you want to stop all sounds or control the volume or panning for all sounds.

» Level Intermediate

Added: 2004-10-12
Rating: 8 Votes: 31
(10 being the highest)
» Author
Kenny Bellew is a technical writer and freelance flash programmer who specializes in Flash audio. He lives in Minneapolis, MN.
» Download
Download the files used in this tutorial.
» Forums
More help? Search our boards for quick answers!


  • There are no comments yet. Be the first to comment!

  • You must have javascript enabled in order to post comments.

Leave a Comment
  • Your email address will not be published. All fields are required.
Featured Flash FLA
» Author: work2survive
» Title: Girl Walking 1kb
» Description: Walking girl, animation just takes 1kb, using high heels shoes, and fashion model attitude.
Featured Sound Loops
Image for equalize

Audio Player

» Author: BoxCat
» Title: CPU Talk
» Description: From the cyberpunk RPG, "Nameless: the Hackers" Completely Free to use! Keywords: edm hip hop rap electronic mysterious mission hacking chase exciting spy ios ambient chilling love happy sad angry suspense
Latest Font
» Author: Fábio FAFERS
» Description: I created this font for free use. Everyone can apply it in personal or business texts. Its free, but I want to be communicated in case of business use. Donations are accepted to keep the project of free fonts alive! Thank you all
Featured Sound Fx
Image for equalize

Audio Player

» Author: nathan
» Description:

A recorded sound of the Dimensional Fork Gate.