# Looping mp3

**URL:** https://forum.kirupa.com/t/looping-mp3/29641
**Category:** Uncategorized
**Created:** [August 28, 2003, 11:39pm UTC](https://forum.kirupa.com/t/looping-mp3/29641 "2003-08-28T23:39:20Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![holePUNCHED](https://avatars.discourse-cdn.com/v4/letter/h/c67d28/32.png) [@holePUNCHED](https://forum.kirupa.com/u/holePUNCHED)
#### Post date: [August 28, 2003, 11:39pm UTC](https://forum.kirupa.com/t/looping-mp3/29641/1 "2003-08-28T23:39:20Z")

</div>

Hola,

Going by past record, after posting this, I should have an answer in just a few short seconds. Here goes

All I want to do, is make the mp3 loops on my site loop. Right now they just stop playing. I need the one that starts up automatically to loop nonstop, also whenever the user presses the prev. or next button, that mp3 needs to loop nonstop as well. Here’s what I got, if someone could just let me know what I need to insert…I know it’s something like (loop 999 times) or something…I’ve seen it before. Thanks

var tracks = [“4.mp3”, “5.mp3”, “6.mp3”,“7.mp3”], i = 0;

track = new Sound();

track.loadSound(tracks\*, true);

stopBTN.onRelease = function() {  
track.stop();  
};

playBTN.onRelease = function() {  
track.loadSound(tracks\*, true);  
};

nextBTN.onRelease = function() {  
i = Math.min(i+1, tracks.length-1);  
track.loadSound(tracks\*, true);  
};

prevBTN.onRelease = function() {  
i = Math.max(0, i-1);  
track.loadSound(tracks\*, true);  
};

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [August 28, 2003, 11:44pm UTC](https://forum.kirupa.com/t/looping-mp3/29641/2 "2003-08-28T23:44:31Z")

</div>

when you’re loading sound and set streaming to true, you can’t control the start properties or delay properties

```auto

loopSound = function () {
        mySound.loadSound("test.mp3", true);
};
mySound = new Sound();
mySound.loadSound("test.mp3", true);
mySound.onSoundComplete = loopSound;

```

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [August 28, 2003, 11:48pm UTC](https://forum.kirupa.com/t/looping-mp3/29641/3 "2003-08-28T23:48:36Z")

</div>

So can I just add that in? I don’t understand.

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [August 28, 2003, 11:50pm UTC](https://forum.kirupa.com/t/looping-mp3/29641/4 "2003-08-28T23:50:48Z")

</div>

Do I need to insert all my tracks into the spot where you put test.mp3??? I declared all the variables earlier, so I was wanting to just loop instead of having it finish

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [August 28, 2003, 11:53pm UTC](https://forum.kirupa.com/t/looping-mp3/29641/5 "2003-08-28T23:53:53Z")

</div>

just use your array name

```auto

var tracks = ["4.mp3", "5.mp3", "6.mp3","7.mp3"], i = 0;

track = new Sound();

loopSound = function () {
       track.loadSound(tracks*, true);
};

track.loadSound(tracks*,true);
track.onSoundComplete = loopSound;

stopBTN.onRelease = function() {
track.stop();
};

playBTN.onRelease = function() {
track.loadSound(tracks*, true);
};

nextBTN.onRelease = function() {
i = Math.min(i+1, tracks.length-1);
track.loadSound(tracks*, true);
};

prevBTN.onRelease = function() {
i = Math.max(0, i-1);
track.loadSound(tracks*, true);
};

```

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [August 29, 2003, 2:56am UTC](https://forum.kirupa.com/t/looping-mp3/29641/6 "2003-08-29T02:56:41Z")

</div>

You don’t need to call the loadSound method again.  
[AS]track.onSoundComplete = track.start;[/AS]  
That would do…

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [August 29, 2003, 3:18am UTC](https://forum.kirupa.com/t/looping-mp3/29641/7 "2003-08-29T03:18:02Z")

</div>

what i did to mine as i dont know Action Scripting, I made another movie clip and place the mp3 there.

then i followed what \*\* kax \*\* told me to place it on one of the layer in your main movie clip. then use the “loadmovie” code thingy. it works with me, but the only thing is, it takes a while to load it using a 56 K Modem connection because mp3 is quite big file.

I can only contribute little things as i am a begginer, but hope that helps

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [August 29, 2003, 4:55am UTC](https://forum.kirupa.com/t/looping-mp3/29641/8 "2003-08-29T04:55:23Z")

</div>

nope, everything works just fine now…Love it! Knew I’d have an answer tonight.

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [August 29, 2003, 5:01am UTC](https://forum.kirupa.com/t/looping-mp3/29641/9 "2003-08-29T05:01:00Z")

</div>

Yup… you can always trust in [kirupaforum.com](http://www.kirupaforum.com). 😛
