0
我想更改声道的音量,而不是将其关闭/从头开始。更改简单声道的音量
这里有一段代码用于处理soundchannel,musicIcon
切换声音。
function musicToggle(e:TouchEvent){
if(musicIcon.alpha != 1){
Chn_musicLoop = musicLoop.play(0,int.MAX_VALUE);
//Instead of restarting the music, I would like to set the volume to it's max (1)
musicIcon.alpha *= 2;
}
else{
musicIcon.alpha *= .5;
Chn_musicLoop.stop();
//Instead of stopping the music, I would like to set the volume to 0.
}}
我需要做什么代码?
如果我想将其设置为0一半的时间和1的另一半? – user2789610
适用相同的规则,您可以将'SoundTransform'变量设置为新的'SoundTransform',调整第一个参数,然后将其应用到您的'SoundChannel'('Chn_musicLoop'),如答案中所示。 –