【发布时间】:2011-10-27 19:10:34
【问题描述】:
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? 这是一个错误吗? 如何修复此错误? 谢谢... -/
【问题讨论】:
-
我无法在 CS4 中使用 3 秒 mp3 重现此测试。在 soundComplete 处理程序中,跟踪返回 1,每个后续计时器事件也是如此。是否有其他因素影响您的输出?
标签: flash audio position channel