Preloading Streaming Mp3's

Hi,

I’m creating a track-player to stream songs into, but I don’t want each song to play unitl 35% of it has been loaded. I thought I had it working good, but it keeps screwing up. Sometimes it will play normally and sometimes it will not. After much messing around I’ve come to the conclusion that it must be the chunk of script below that’s messing things up, since it shouldn’t be able to get past that script until 35% is loaded, but sometimes does anyway.

Can anyone see any reason this scripting is flawed?

bytes_loaded = mySound.getBytesLoaded();
bytes_total = mySound.getBytesTotal();
getPercent = bytes_loaded/bytes_total;

if (getPercent > .35) {
this.gotoAndPlay(6);
}

On the next frame there is a direction to send it back to that frame.

Also, if anyone knows where a tutorial on making a track-player is, that would be great!

Thanks for any help,
spazzblaster