# Dybamically Loaded MP3 Won't Start On First Try

**URL:** <https://forum.kirupa.com/t/dybamically-loaded-mp3-wont-start-on-first-try/91236>\
**Category:** Uncategorized\
**Created:** [September 30, 2003, 9:20pm UTC](https://forum.kirupa.com/t/dybamically-loaded-mp3-wont-start-on-first-try/91236 "2003-09-30T21:20:16Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![gorilla1](https://avatars.discourse-cdn.com/v4/letter/g/278dde/32.png) [@gorilla1](https://forum.kirupa.com/u/gorilla1)\
**Post date:** [September 30, 2003, 9:20pm UTC](https://forum.kirupa.com/t/dybamically-loaded-mp3-wont-start-on-first-try/91236/1 "2003-09-30T21:20:16Z")

</div>

I am working on tryinng to load mp3’s dynamically. I am using code from Billy T below for laoding the file. Works great for the load. But then I tried to start the loaded mp3 . It plays fine on my pc locally, but not if I put it on a server and then try it. To get it to work, you must refresh your browser - i.e. it only plays on the second load (or sometimes third). This is driving me pretty crazy - why would this be?

Here is the link to the swf on the server - you will see that a refresh is needed to get the music to play:

[http://www.efuturevision.com/juke/test3.html](http://www.efuturevision.com/juke/test3.html)

Here is the entire fla that is playing on the server:

```auto
mSound = new Sound();
mSound.loadSound("coolloop.mp3");
sndFrameFunc();
//test load sound
myMusicPosition = 0;
mSound.start(myMusicPosition, 0);
function sndFrameFunc() {
	if (!this.fullyLoaded) {
		this.onEnterFrame = function() {
			var t = mSound.getBytesTotal();
			totalbytes.text = t;
			var l = mSound.getBytesLoaded();
			bytesloaded.text = l;
			var pc = l/t;
			percentdone.text = pc*100+"%";
			this.loadBar2._width = pc*100;
			if (t && l == t) {
				this.fullyLoaded = true;
				delete this.onEnterFrame;
				result.text = "Deleting onEnterFrame within if block...";
			}
		};
	}
}

```
