Hi to all
Can anybody help me with sound duration question?
I created audio player. Here is a part of code:
function playSong(this_cps):Void
{
…………
s.loadSound(sa[cps].earl, true);
s.setVolume(curVolume);
var my_intervalLoad = setInterval(checkProgressLoading, 100, s);
s.onLoad = function(success:Boolean) {
if (success) {
progress_loading_mc._xscale = 100;
clearInterval(my_intervalLoad);
}
};
progress_mc._xscale=0;
progress_loading_mc._xscale=0;
this.onEnterFrame = HandleSlides;
}
function checkProgressLoading(the_sound:Sound):Void {
var pct:Number =
Math.round(the_sound.getBytesLoaded()/the_sound.getBytesTotal()* 100);
progress_loading_mc._xscale = pct;
}
function HandleSlides(){
progress_mc._xscale =
Math.round(100*s.position/s.duration);
}
I see that duration is not correct in the beginning while sound file
is not loaded yet. Loading is in process , sound is already playing
but my progress bar that shows s.position/s.duration is not correct
because duration is not correct. How I can solve this problem?
Is that possible to show that correct before sound is completly loaded?
Thank you in advance.
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders