Search code examples
flashactionscript-3volumemicrophone

Speaker volume in Flash AS3


Is there any way by which I can change the volume of the Speaker?

When I use Microphone class, I can set the mic.gain to set the gain in the microphone, likewise can I change the volume of the speaker?

I have seen, some websites allow you to change the decibel gain of the speaker in Flash. Can anyone help me understand this?

Thank You.


Solution

  • To change global sound values:

    For AS2 change the sound volume of the _root:

    var volumeChangeSound:Sound = new Sound(_root);
    volumeChangeSound.setVolume(0); // goes from 0 to 100
    

    For AS3:

    import flash.media.SoundMixer;
    var transform1:SoundTransform=new SoundTransform();
    transform1.volume=0; // goes from 0 to 1
    flash.media.SoundMixer.soundTransform=transform1;
    

    Sounds in as3: Tutorial: AS3 Basics – How to use library sounds in AS3 | 8bitrocket