# Loop Music, "howto" in code?

**URL:** <https://forum.kirupa.com/t/loop-music-howto-in-code/156280>\
**Category:** Uncategorized\
**Created:** [July 24, 2005, 4:50pm UTC](https://forum.kirupa.com/t/loop-music-howto-in-code/156280 "2005-07-24T16:50:58Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kaotik](https://avatars.discourse-cdn.com/v4/letter/k/fbc32d/32.png) [@Kaotik](https://forum.kirupa.com/u/Kaotik)\
**Post date:** [July 24, 2005, 4:50pm UTC](https://forum.kirupa.com/t/loop-music-howto-in-code/156280/1 "2005-07-24T16:50:58Z")

</div>

Hi everybody,  
I am using the “Volume Control Slider” tutorial for my flash site. [http://www.kirupa.com/developer/mx/volume\_slider.htm](http://www.kirupa.com/developer/mx/volume_slider.htm) I’ve got everything working perfectly on my end except one problem. My mp3 does not loop to start over again after it’s played once. It just plays once then stops. I need it to play again after the song’s ended. I have a bit of customization to the code verses what the tutorial has so that my music starts on load at top volume, but how can I get it to play as a loop?  
Here’s the setup I’m using thus far:

```auto
 
onClipEvent (load) {
 mySound = new Sound();
 mySound.loadSound("music1.mp3", true);
 speed = 5;
 volume = 0;
 _root.volume = 100;
 dragger._x = line._width*_root.volume/100;
}
onClipEvent (enterFrame) {
 downloaded = mySound.getBytesLoaded();
 total = mySound.getBytesTotal();
 if (downloaded != total) {
  _root.dl = "downloading music...";
 } else {
  complete = 99;
  _root.dl = "";
 }
 d = (_root.volume>volume)-(_root.volume<volume);
 volume += d;
 mySound.setVolume(volume);
}

```
