# Mp3 loading issues

**URL:** <https://forum.kirupa.com/t/mp3-loading-issues/157082>\
**Category:** Uncategorized\
**Created:** [July 29, 2005, 7:51pm UTC](https://forum.kirupa.com/t/mp3-loading-issues/157082 "2005-07-29T19:51:18Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![1square](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/1square/32/1582_2.png) [@1square](https://forum.kirupa.com/u/1square)\
**Post date:** [July 29, 2005, 7:51pm UTC](https://forum.kirupa.com/t/mp3-loading-issues/157082/1 "2005-07-29T19:51:18Z")

</div>

I am attempting to create a function that loads an Mp3 into a .swf sequentially after the .swf is loaded and before the movie plays. When I am testing the .swf the sound loads in fine, all is well. When first viewed online all again is well. However, when returning to the site and attempting to view for a second time (cached .swf) the sound fails to load. Has anyone experieced this issue? Below is the code:

While the .swf is loading this script is attached to a MC that has the sound’s volume slider within. This MC is called mySlider.

onClipEvent (load){  
mySound = new Sound();  
mySound.loadSound(“music.mp3”, false);  
}

Once the .swf is loaded the user is moved to the next frame in the time line which contains an MC with a loader bar in it showing the Mp3’s loading progress. Attached to this MC is the following code.

onClipEvent(load) {  
totalBytes = \_root.mySlider.mySound.getBytesTotal();  
this.loaderBar.\_yscale = 0;  
}

onClipEvent (enterFrame) {  
bytesLoaded = \_root.mySlider.mySound.getBytesLoaded();  
soundLoaded = bytesLoaded/totalBytes;  
percentLoaded = int(100\*soundLoaded);  
this.loaderBar.\_yscale = percentLoaded;  
if (soundLoaded \>= 1.0) {  
\_root.gotoAndPlay(3);  
}

}

Once this is loaded the timeline plays through, on the third frame there is a little piece of code that initiates the sounds play back.

\_root.mySlider.mySound.start(0, 999);

Good luck and thanks in advance.
