我有几个声音,我怎么能一个一个地播放它们。当我只使用play()时,声音会同时播放。我也尝试过处理SOUND_COMPLETE事件,但它没有用。
sampleMP3A.play().addEventListener(
Event.SOUND_COMPLETE,
function(event:ResultEvent, o:Object):void {
sampleMP3B.play();
});
sampleMP3A效果很好,但是样本MP3不能播放。
答案 0 :(得分:2)
private var sounds:Array // it contain your sounds.
private var ind:Number = 0;
private function playSounds():void
{
var req:URLRequest = new URLRequest(sounds[ind]);
var s:Sound = new Sound(req);
var soundChannel:SoundChannel = new SoundChannel;
soundChannel = s.play();
soundChannel.addEventListener(Event.SOUND_COMPLETE,onComplete);
}
private function onComplete(event:Event):void
{
ind++;
playSounds();
}