我认为Soundtransform不起作用

时间:2013-02-04 03:46:02

标签: actionscript-3 audio

I am trying to lower the volume of this sound since it's like a background music track but it's sounding the same why is it and how can I fix it?

var morning:Morning1 = new Morning1();
var morningChannel:SoundChannel = new SoundChannel ();
var transforming:SoundTransform = new SoundTransform(0.1);
morningChannel = morning.play ();
morningChannel.soundTransform = transforming;

这就是它应该如何

最终工作:

var morning:Sound =new Morning1 ();
//telling the sound to lower
var transforming:SoundTransform = new SoundTransform(0.05);
var morningChannel:SoundChannel = morning.play(0,1,transforming);

3 个答案:

答案 0 :(得分:0)

要更改声音的音量,请将第三行替换为:

var transforming:SoundTransform = new SoundTransform;
transforming.volume = 0.1;

哦,你必须拥有它,以便在你改变它的属性后播放声音,所以将morningChannel = morning.play ();移到最后。

答案 1 :(得分:0)

你必须在播放声音之前应用转换=) morning.play应该是最后一行。

答案 2 :(得分:0)

var morning:Sound =new Morning1 ();
//telling the sound to lower
var transforming:SoundTransform = new SoundTransform(0.05);
var morningChannel:SoundChannel = morning.play(0,1,transforming);