# Music loop - how can I stop it!

**URL:** <https://forum.kirupa.com/t/music-loop-how-can-i-stop-it/243715>\
**Category:** flash\
**Created:** [November 9, 2007, 9:01pm UTC](https://forum.kirupa.com/t/music-loop-how-can-i-stop-it/243715 "2007-11-09T21:01:46Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![northstar\_86](https://avatars.discourse-cdn.com/v4/letter/n/b3f665/32.png) [@northstar\_86](https://forum.kirupa.com/u/northstar_86)\
**Post date:** [November 9, 2007, 9:01pm UTC](https://forum.kirupa.com/t/music-loop-how-can-i-stop-it/243715/1 "2007-11-09T21:01:46Z")

</div>

I have a built in music player with several different tracks, after a song is complete is starts over and continues. I can not seem to stop the loop, any help would be much appreciated!  
here is my source.

var numtrack = 1;  
var maxTracks = 3;  
my\_sound = new Sound();  
my\_sound.loadSound(“music/track1.mp3”, false);  
//  
my\_sound.onLoad = function(ok) {  
if (ok) {  
clearInterval(interval);  
this.start();  
tf\_txt.text = “”;  
}  
};  
function loader(sound) {  
var gbl = sound.getBytesLoaded();  
var gbt = sound.getBytesTotal();  
tf\_txt.text = “LOADING “+int(gbl/gbt\*100)+”%”;  
}  
my\_sound.onSoundComplete = function() {  
my\_sound.start();  
};  
interval = setInterval(loader, 100, my\_sound);  
//  
// player controls  
btnNext.onRelease = function() {  
numtrack++;  
if (numtrack == maxTracks+1) {  
numtrack = 1;  
}  
my\_sound.loadSound(“music/track”+numtrack+".mp3", false);  
interval = setInterval(loader, 100, my\_sound);  
trace(numtrack);  
};  
btnPrev.onRelease = function() {  
numtrack–;  
if (numtrack == 0) {  
numtrack = 3;  
}  
my\_sound.loadSound(“music/track”+numtrack+".mp3", false);  
interval = setInterval(loader, 100, my\_sound);  
trace(numtrack);  
};  
btnStop.onRelease = function() {  
my\_sound.stop();  
};  
btnPlay.onRelease = function() {  
my\_sound.stop();  
my\_sound.start();  
};
