开发者

channel.position never equal sound.length in as3

开发者 https://www.devze.com 2023-03-28 13:40 出处:网络
var snd:Sound = new Sound(); var t:Timer = new Timer(100); var sndChannel:SoundChannel; snd.addEventListener(Event.COMPLETE,onComplete);
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开发者_如何学Go(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
}

/- Can anybody tell me why 'sndChannel.position/snd.length' always less than 1? Is this a bug? How to fix this bug? Thanks... -/


i am confused as to what the real problem is, but for example sndChannel.position can for example range between 1 and 100 (just example). and snd.length in this example would be 100. so you get position for example 50 divided by 100 it gives you 0.5 which is less than 1. which means that you are 50% through the sound clip. I dont see any bug here or issues? what are you trying to achieve?

woops, just read the title... post the trace, what are the values?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号