Blog
1

This is what I usually do, but it may or may not be the easiest or most sophisticated way of implementing a mute button in actionscript 3. I use Flash CS3 IDE and actionscript 3.0 for the coding, this solution might not work in earlier versions.

To make a mute button, first we need to define two SoundTransform instances, one for muting and the other for un-muting. When the button is clicked, depending on the current state, either of these SoundTransform instances are assigned to the soundTransform property of the global SoundMixer.

var muteTransform:SoundTransform = new SoundTransform(0.0,0.0);
var playTransform:SoundTransform = new SoundTransform(1.0,0.0);

function muteSound():void {
	SoundMixer.soundTransform = muteTransform ;
}

function unmuteSound():void {
	SoundMixer.soundTransform = playTransform ;

}

1 Comment to “Mute button in actionscript 3”

Post comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>