Adjust Global Sound Volume in Actionscript 3

There is a simple way to adjust all global sound in Actionscript 3. This encompasses all playing loops, sound effects and such.

All you need is the following code:

1
2
3
4
5
import flash.media.SoundMixer;
import flash.media.SoundTransform;

// volume limits are 0 to 1 (0.1,0.2,0.3,...,1)
SoundMixer.soundTransform = new SoundTransform(0);

Of course change the number sent to the SoundTransform constructor to anything between 0 and 1 (0.5 would be half max volume, 0 is muted.)

You can leave a response, or trackback from your own site.

Facebook comments:

2 Responses to “Adjust Global Sound Volume in Actionscript 3”

  1. avatarMasamune says:

    Thanks, very usefull compared to all of this shitty as2 codes

  2. avatarnuthman says:

    Yeah, as2 was a nightmare..

Leave a Reply

You must be logged in to post a comment.