Groups | Blog | Home
all groups > flash (macromedia) > october 2006 >

flash (macromedia) : Sound Stop AND Start


yevri
10/9/2006 9:03:50 PM
Hi,

I have a presentation with voice-over and background music separate. I usually
will put a looped sound on another level and have a button toggle between
loading and unloading that movie to mute and unmute the background music. But
this time I just need to turn on and off ALL sounds (basically turn sound
volume for all sounds from 100 to 0 and vice versa when they toggle back and
forth). The voice-over is a dozen audio files on the timeline of _level2 as
will be the background music. I don't want to create sound objects for every
one of those sounds or have to create movieClips as holders, etc.

Is there a way that I can just tell it to stop all sounds and start all sounds
without having to go through creating sound objects, etc.? Isn't there a global
StartAllSounds? Seems like this should be easier. Can I write something that
will start all sounds in _level2?

Thanks,
Brian
yevri
10/9/2006 11:24:45 PM
I found this on Flashkit.com. I used this global script and it worked great.
Since my audio was on _level2, I substituted _level2 for _root and instead of
putting the first line on the main timeline, I put it in the timeline of the
_level2 movie.


// on main timeline
globalvolume = new Sound(); // no associated movie clip.

//button to mute sound and change toggle mc frames
on(release){
if(_root.globalvolume.getVolume() > 0){
_root.globalvolume.setVolume(0); // mutes all sound
play(); //switch to mute frame
} else {
_root.globalvolume.setVolume(100); // unmutes all sound
play(); //switch to unmute frame
}
}
AddThis Social Bookmark Button