Flash: How to Mute or control volume of sounds embedded on the timeline

by troy on April 13, 2009

How the mute a clip on the timeline?!! With all the of the classes in the AS3 Sound Arsenal (SoundMixer, SoundChannel, Sound, SoundTransform..oh my!), this is simple but not as self evident so here it is.

In AS2 it looked like this

var sound21:Sound = new Sound(someSpriteOrMovieClass);

Every Sprite based displayobject has a soundTransform. Counter-intuitively, setting the soundTransform.volume does nothing. To control volume you HAVE to set it to a new SoundTransform with the desired values.


someSpriteOrMovieClass.soundTransform = new SoundTransform(0);