Preloader for LoadSound() object

Hey guys, I was just wondering if it’s possible to create a working loadbar giving the status on a streaming mp3 file. All i want to do is, while the file is playing, for a little animation to show the percentage of the file that has actually been downloaded so far. F.Y.I. I checked out the code to Voets.’ streaming xml player and that didn’t help. Any ideas on how to get the percentage bar working?

For more information:

redload is a movie clip that should increase in width until reaching 100% (150 pixels wide), determined by bytes_loaded/bytes_total.

All music.php does is sends the full address of an mp3 file using the variable playsong.

Unfortunately, the percentageBar (loadbar) doesn’t work and is commented out.

// CODE ---------------------------------------->

loadMySong = function () {
//this.mplayer.redload._width = 1.0;
htmlData = new LoadVars();
htmlData.load(“music.php?dummy=” + Math.random());
htmlData.onLoad = function (true) {
if (true) {
playsong = this.play;
songname = this.name;
}
}
};

/this.mplayer.percentageBar = function (true)
{
loaded = Math.round(theStream.getBytesLoaded());
total = Math.round(theStream.getBytesTotal());
getPercent = loaded/total;
this.mplayer.redload._width = getPercent * 150;
};
/

var theStream = new Sound();
mplayer.now_playing = “go ahead, make my day”;
loadMySong();

mplayer.pause.onPress = function ()
{
theStream.stop();
mplayer.now_playing = “—”;
};

mplayer.play.onPress = function ()
{
loadMySong();
theStream.stop();
mplayer.now_playing = songname;
theStream.loadSound(“http://localhost:8000”+playsong, true);
//percentageBar();
};