Preloader Music

How do I add music to a preloader? i tried putting the music on the same frame as the preloader and it didn’t work… and i tried putting it on a new layer in the same frame # as the preloader but satill doesn’t work…

any suggestions??

function loadSound() {
	
	// create a holder for the sound, a instance of the sound object, and load in the sound file
	_root.createEmptyMovieClip("soundHolder", 1);
	userSound = new Sound(soundHolder);
	userSound.loadSound(urSoundPath, true);
	
	// get the sound length
	soundLength = formatTime(userSound.duration)
	
	// set the textfields
	_root.min.text = soundLength.minutes;
	_root.seconds.text = soundLength.seconds;
	
	notDone == true;
	
	_root.onEnterFrame = function () {
	
		percentage = userSound.getBytesLoaded() / userSound.getBytesTotal() * 100;
		
		if (percentage > 5 && notDone == true) {
			notDone = false;
			userSound.start();
		}
		
		if (percentage >= 100) _root.onEnterFrame = undefined;
		
		percentageBar._xscale = percentage;
	
	}
	
}

function formatTime(milliseconds) {
	// find minutes expressed in decimal
	minutes = new Number((milliseconds/1000)/60);
	
	// split the minutes to find the minute (str[0]) and the seconds expressed in decimal
	str = new String(minutes.toString());
	str = str.split(".");
	
	// return an object with minutes and seconds properties
	// to find minutes, multiply the seconds expressed in decimal to find the seconds in integer format
	return {minutes:str[0], seconds: Math.round(("." + str[1])*60)};
}

This would work!

yours,
–h88

Using the values from the getBytesTotal and getBytesLoaded method you can quickly create a sound buffer, so your sound won’t start playing until enough of the sound has loaded