Audio preloader not working

i’m getting deseprate by now… i’ve been trying to get my audio preloader to work for 7h straight, and no positive results… it should be simple:

// actions on main timeline frame 1
stop();
my_sound = new Sound();
my_sound.loadSound(“song.mp3”, false);

// actions of a movie clip named mc_preloader that is also on the main timeline frame 1

onClipEvent(load){
bytestotal = _root.my_sound.getBytesTotal();
}
onClipEvent(enterFrame){
bytesloaded = _root.my_sound.getBytesLoaded();
_root.loaded.text = bytesloaded;
}

// there is also a dynamic text box on the first frame in the main timeline with an instance name of “loaded”

And it doesnt show the bytes loaded… i’m about to kill myself… why isn’t it working ?

ok, try this, get rid of all those actions on the movie clip, erase your timeline actions too. replace your timeline actions with this :


mySound = new Sound(this);
mySound.loadSound("song.mp3")
loadBar._width = 0;
this.onEnterFrame = function() {
	total = myMusic.getBytesTotal();
	loaded = myMusic.getBytesLoaded();
	percent = Math.round((loaded/total)*100);
	loadText = percent+"%";
	this.loadBar._width = percent;
	if (loaded == total && total > 0) {
		myMusic.start(0,1);
		delete this.onEnterFrame;
	}
};

make sure your preloader bar instance name is “loadBar” or it wont work.

i changed the code a little… but it still doesn’t work, shows 100% all the time.

 mySound = new Sound(this); 
mySound.loadSound("Song.mp3");
loadBar._width = 0;
this.onEnterFrame = function() {
	total = mySound.getBytesTotal();
	loaded = mySound.getBytesLoaded();
	percent = Math.round((loaded/total)*100);
	loadText = percent+"%";
	_root.percentage.text = loadText;
	this.loadBar._width = percent;
	if (loaded == total && total>0) {
		myMusic.start(0, 1);
		delete this.onEnterFrame;
	}
};

2 questions:

  1. did you make sure you named your movieclip instance “loadBar” ?

  2. do you have everything targeted correctly…like your loadBar movieclip?

of all thats correct then post your .fla and ill look at it. i had this exact same problem a while back.

thanks for helping me… the sound thing seems completely impossible… i’ll post the *.fla file in 20 minutes

here’s the file… it just shows 100% all the time :frowning:

EDIT: ****… now it seems to be working… when i simulated the download progress through FlashMx on my hard drive it showed 100% all the time… but when i uploaded it to the internet it worked perfectly :-/