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?这是一个错误吗?如何修复这个错误?谢谢... - /

4

1 回答 1

0

我对真正的问题是什么感到困惑,但例如 sndChannel.position 的范围可以在 1 到 100 之间(仅作为示例)。并且 snd.length 在这个例子中是 100。所以你得到的位置例如 50 除以 100 它给你 0.5 小于 1。这意味着你通过声音剪辑的 50%。我在这里没有看到任何错误或问题?你想达到什么目的?

糟糕,只需阅读标题...发布跟踪,值是什么?

于 2011-08-16T13:59:29.733 回答