# mp3 plays twice!

**URL:** <https://forum.kirupa.com/t/mp3-plays-twice/287903>\
**Category:** flash\
**Created:** [May 7, 2009, 4:21pm UTC](https://forum.kirupa.com/t/mp3-plays-twice/287903 "2009-05-07T16:21:32Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![maxelcat](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/maxelcat/32/2854_2.png) [@maxelcat](https://forum.kirupa.com/u/maxelcat)\
**Post date:** [May 7, 2009, 4:21pm UTC](https://forum.kirupa.com/t/mp3-plays-twice/287903/1 "2009-05-07T16:21:32Z")

</div>

Hi

I want an mp3 stream to start playing once a separte swf has finished loading.

I have set up a listener for the swf. Inside the onLoadComplete function I have added some code for the mp3 streaming.

I am pretty sure that the listener is working, since other events aren’t triggered wrongly. However…

Sometimes the sound clip starts to play (and shows as 100% loaded) and then jumps back to the start, and the loader whizzes down. It doesn’t appear to play before the swf is loaded though…

```auto

mclListener.onLoadComplete = function(target_mc:MovieClip, status:Number):Void {
  //trace("loaded");
 :
 : 
 
  //get soundUrl
 
  soundToLoad.loadSound(episode+"/"+soundUrl, true);
 
  soundToLoad.onLoad = function () {
      this.start(0, 1);
      createSoundInterval();
   }
 
}//end onLoadComplete
 
function createSoundInterval():Void{
 
 soundIntervalID = setInterval( this, "soundProgress", soundInterval);
 trace ("sound interval"+soundIntervalID);
}
 
function soundProgress():Void{
 var soundPercent:Number = Math.round(100*(soundToLoad.position/soundToLoad.duration));
 soundControl.loaderBar._width=300*soundPercent/100;
 
 //trace (soundPercent+"%");
 if (soundPercent >=100){
  clearInterval(soundIntervalID);
 }
 
}
 

```

Oddly the trace soundIntervalID shows that sometimes more than 1 interval is being created.

What can I do to ensure the mp3 only plays once?

thanks

E

PS if you want you can see teh offedning beast at [www.ee-web.co.uk/ase/index.html](http://www.ee-web.co.uk/ase/index.html) - only the first 3 buttons have sound clips associated with them
