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
Search
News
Blog
- Fetching data from multiple tables in one MySQL query – Part 2
- Fetching data from multiple tables in one MySQL query
- Let’s Go A Hunting
- Java Applet and Javascript message passing
- The Right-Click Menu in Flash
- Stroke hinting
- Python: C++ style cin, cout in Python
- Python: Working in Unicode
- Website Security : Directory Listing Issue
- Hyperlink in actionscript 3


May 31, 2009 in

August 19, 2010 at 5:57 pm
[...] Mute button in actionscript 3 | Mukto Software Ltd. [...]