;

PDA

Click to See Complete Forum and Search --> : Loop position is bugged?


gilamran
01-16-2008, 11:03 PM
Hi,
If you import a wav or mp3 file into your scene and play it in a loop... there's no way you can tell how many times it was looped...

If you check the position of the loop eveyframe you'll get some incrementing number... (Not really the position) so I guess that this is a position in a loooong looped sound, so I try to figure out the loop counter by dividing by the loop length... nop, not good... you'll get worng numbers, near but wrong...

Here's an example:

var Loop:LoopClassLink = new LoopClassLink();
var sc:SoundChannel;
sc = Loop.play(0, 1000);

// onEnterFrame
addEventListener(Event.ENTER_FRAME, onFrameEnter);
function onFrameEnter(e:Event) : void
{
trace(sc.position/beat.length);
}

Can anyone help with this??

Thanks
Gil.

joshstrike
01-16-2008, 11:14 PM
What if you just do the loop by adding a sound finished listener to the channel and replay it each time? Then you can count... does that get glitchy or something...? I would guess it worked in roughly the same way as adding a loopcount in the constructor...