任何帮助将不胜感激。
我正在加载这样的声音:
var mySound:Sound = new Sound();
mySound.load(new URLRequest("audio/filename.mp3"));
mySoundChannel:SoundChannel = mySound.play();
mySoundChannel.addEventListener(Event.SOUND_COMPLETE,audioComplete);
function audioComplete(Event:Event){
trace("done!");
}
最佳答案
更改
function audioComplete(Event:Event){
function audioComplete(event:Event){
event
与Event
不同。 Event
是类的名称。 event
是您分配给Event
类型的本地变量的名称sound.load()
时,Flash Player将开始在新线程上加载声音,并在加载声音时继续下一行代码。声音完全加载时,将触发Event.COMPLETE
事件,声音播放完毕后,将触发 NOT 。setTimeout
var mySound:Sound = new Sound();
mySound.load(new URLRequest("audio/filename.mp3"));
mySound.addEventListener(Event.COMPLETE, soundLoaded);
function soundLoaded(e:Event):void {
mySound.play();
setTimeout(audioComplete, mySound.length);
}
function audioComplete(){
trace("done!");
}
https://stackoverflow.com/questions/7773581/