Audio progress bar

(mx) I’m trying to make an audio progress bar. I’d like any help that can be given to help me accomplish this. I’m loading the songs externally when it is selected. I just need a bar to represent the song being loaded. I’m loading the songs from .mp3s

track1= new Sound
track1.loadSound(“morning.mp3”,false);

all= track1.getBytesTotal();

bytes_loaded = Math.round(track1.getBytesLoaded());

getPercent = bytes_loaded/all;

this.loadBar._width = getPercent100;
this.loadText = Math.round(getPercent
100)+"%";
if(bytes_loaded/all >=.59){
gotoAndPlay(3);
}

the loadBar is the name of the progress bar_mc…this is the script I’m using, but I’d scrap it for a script that works…

um…

  1. Keep track, or better yet, find out how long each song is, preferably in milliseconds.

  2. start a timer as soon as the song starts

  3. divide (2)/(1) multiply it by 100, and you’ve got your progress percentage.

  4. apply this to an object using their _xscale/_yscale (optional) bar. set (3) equal to the objects scale and you’ve got your progress bar.

This works very much the same as preloaders, which seem to be such a problem for everybody…

thanks for the advice, but how would I make the timer…the beginning is no problem.

I’m loading the songs from mp3s

Flash 6 has the SoundObj.position and SoundObj.duration commands, so you could try those…

thanks pissant…I’ll check them out, I know you can divide them