tags:

views:

247

answers:

3

Hello.

I'm playing several video streams in my flex application. Plus there are sounds of application UI. Is there possibility to mute entire application or I should silence each of potential sound sources?

+1  A: 

I'm pretty sure there is no way to do that with ActionScript out of the box. You'll need to have some manager class that keeps track of all the sounds (Sound, SoundChannel, SoundTransform, etc and your video streams) in your application and that has logic for muting.

If you can force your users to use firefox, there is a plugin available to mute swf files. Mute Flash - https://addons.mozilla.org/en-US/firefox/addon/5453

Christophe Herreman
+1  A: 

Have you tried

SoundMixer.soundTransform = new SoundTransform(0, 0);
sharvey
It's useful only for streamed and emended sound, not auto-generated, but it's my case.
Artem Tikhomirov
+1  A: 

You probably have to re implement your app to centralize the control of audio components within your app. There is a design pattern out there called Inversion of Control that may be useful for this problem.

http://en.wikipedia.org/wiki/Inversion_of_control

Specifically with Flex, you should lookup the Model Locator pattern with Cairngorm.

http://www.adobe.com/devnet/flex/articles/cairngorm_pt2_06.html

You could use this to store all the various audio levels for your application in a single location. And you could add a method called muteAll() that would go in and set all the levels to 0. Anytime you create a new audio component in the app make sure to add a reference to its volume level in the model locator. Bind the audio's volume level to the value set in the model locator. Then elsewhere in the app you can change the value in the model locator and through binding the audio component you build will get updated.

This might also be helpful.

http://livedocs.adobe.com/flex/3/html/help.html?content=Working_with_Sound_23.html#160274

Gordon Potter