0
var snd:Sound = new Sound();
var t:Timer = new Timer(100);
var sndChannel:SoundChannel;
snd.addEventListener(Event.COMPLETE,onComplete);
t.addEventListener(TimerEvent.TIMER,onTimer);
snd.load(new URLRequest('some.mp3'));
function onComplete(e:Event):void
{
sndChannel = snd.play();
t.start();
sndChannel.addEventListener(Event.SOUND_COMPLETE,onSndComplete);
}
function onTimer(e:TimerEvent):void
{
trace(sndChannel.position/snd.length); // less than 1
}
function onSndComplete(e:Event):void
{
trace(sndChannel.position/snd.length); // also less than 1
}
/- 任何人能告訴我,爲什麼 'sndChannel.position/snd.length' 總是小於1? 這是一個錯誤? 如何解決這個錯誤? 謝謝... -/channel.position從來沒有在AS3等於sound.length
我無法用CS4中的3秒鐘mp3重現此測試。在soundComplete處理程序中,跟蹤返回1,每個後續計時器事件都會返回。是否有可能影響你的輸出的其他因素? – shanethehat