[AS] MP3 preloader and sound object

Hi all,
First time I post on this great website.

And… I have a problem… (no, really? hmmm… yes!)
Excuse my broken English (I will try to be clear).

I’m creating a MP3 jukebox for my website, a Movie Clip (MC) named “miniJuke”. A function “preloadSound” is called, and should preload my sound object. But it doesn’t work : I get a NaN until the movie is fully loaded and then I get 100.

Here is my code :

// the sound preloader function, where “pieceOfCake”
// is the path to find my MP3

function preloadSound(pieceOfCake){
this.createEmptyMovieClip (“tempLoader”,this);

tempLoader.onEnterFrame = function() {
var bl = mySound.getBytesLoaded();
var bt = mySound.getBytesTotal();
var p = isNaN(bt)?0 : Math.floor(bl*100/bt);

if (p < 100){
_root.miniJuke.percent.text = p;
trace (“that works ?”);
}else{
mySound.start (0,99);
mySound.isPlaying = true;
tempLoader.removeMovieClip();
}
};
mySound.loadSound(pieceOfCake,false);
};

“percent” is a textfield, “mySound” is the sound object.
The “trace” instruction (that works?) is never displayed, so, i think than “p” is never lower than “100”.

How to preload “mySound” correctly ?
I really need help.
Thx.

I apologize, I didn’t see ActionScript Forum.
I copy this post.
<:}