Turn off sound only - how

Hello,

I have this problem:

How do you turn off the sound in a game only? I ask because I have two buttons in my settings: turn music on/off and sound on/off. turning music on and off is really easy because it uses a specific sound channel. But How do you turn off the volume the sound only (e.g. music is still playing but not the sound of the game)?

When I mute the sound via SoundMixer.soundtransform you can’t hear anything so that’s not what I wanted to have. In my game all sounds are thrown into an array. My first idea was that I go through all sounds listed in the array and turn off the volume but that’s not working. Please - can anyone help? Thank you very much.


//not working

private var sounds:Array;
private var soundChannels:Array = [];
private var muteSoundTransform:SoundTransform = new SoundTransform();


public function muteSoundOnly():void {


muteSoundTransform.volume = 0;
            
var soundLength:int = soundChannels.length - 1;
for (var soundCtr:int = soundLength; soundCtr >= 0; soundCtr--)
{
                
    soundChannels[soundCtr].soundTransform = muteSoundTransform;
                
    }
            
}