一直寻找as中控制全局声音的方法,在网上看到了,有人说是SoundMixer类,但是试了一下用如下方法,竟然无效.
1 if(value)
2 SoundMixer.soundTransform.volume = 1;
3 else
4 SoundMixer.soundTransform.volume = 0;
5
6
后查了很多资料,发现soundTransform类不是这么用滴,要想改变SoundMixer和SoundChanel的soundTransform属性,必须用下面方法:
var soundTransform:SoundTransform = new SoundTransform();
if(value)
soundTransform.volume = 1;
else
soundTransform.volume = 0;
SoundMixer.soundTransform = soundTransform;