我已经设法使用GreenSock的代码和插件淡化OUT声音:
import com.greensock.TweenLite;
import com.greensock.TweenMax;
var snd = new buller();
var channel:SoundChannel = snd.play(0,999);
TweenMax.to(channel, 1, {volume:0, onComplete:snd.stop});
我不能做的就是淡化声音。尝试设置初始声级但无法使其正常工作。感谢我能得到的任何帮助。
答案 0 :(得分:0)
var snd = new buller();
var channel:SoundChannel = new SoundChannel();
var St::SoundTransform = new SoundTransform();
var TimerFade:Timer = new Timer(1,100);
//set the initial sound volume
St.volume = 1;
//play the sound
channel = snd.play(0,0,St);
//Fade in/out the sound
TimerFade.addEventListener(TimerEvent.TIMER,VolumeHandler);
TimerFade.addEventListener(TimerEvent.TIMER_COMPLETE,StopSound);
TimerFade.start();
private function VolumeHandler(e:TimerEvent):void{
var Lastpos:Number = channel.position;
channel.stop();
St.volume -= 0.1;
channel = snd.play(Lastpos,0,St);
}
private function VolumeHandler(e:TimerEvent):void{
channel.stop();
}