Archive for January, 2010

Mute / UnMute Sound AS3

Posted in AS3 on January 13th, 2010 by admin – 3 Comments

If you need to mute/unmute a sound in a MovieClips timeline (eg. if you have a player that loads external swfs)
Try using SoundMixer and soundTransform like this:

1
2
3
4
5
6
7
8
import flash.media.SoundTransform;
import flash.media.SoundMixer;
 
// Mute - sets volume to 0
SoundMixer.soundTransform = new SoundTransform(0);
 
//UnMute - sets volume to 1 (100%)
SoundMixer.soundTransform = new SoundTransform(1);

Of course there are other ways to do it but this was exactly what I needed for my project and it worked just fine.
Feel free to comment other ways to do it.

Cheers!