Next track in music player?

Hi guys. I’m trying to build a music player that has multiple songs it can play. It should be fairly simple with next and previous buttons. I’m trying to get it to load a song based on an array I have created. Everything works fine with only one track but I’m unsure how to add more tracks. This is what I’ve done so far:


stop();

// --------------------------<load and loop sound>-------------------------- \\
this.createTextField("status_txt", this.getNextHighestDepth(), 72,630,100,22);

// create a new Sound object
var my_sound:Sound = new Sound();
musictext.text = "loading";
// if the sound loads, play it; if not, trace failure loading
my_sound.onLoad = function(success:Boolean) {
if (success) {
my_sound.start();
musictext.text = "music on";
} else {
status_txt.text = "Sound failed";
}
};
/* Experimental
var soundUrls:Array = ['Navn1']
switchTrack = function (trackNr) {
my_sound.stop();
my_sound.loadSound(soundUrls[trackNr]);
}*/
// load the sound

var songnr:Array = ['song0']
for (var i = 0; i<songnr.length; i++)
switchTrack = function() {
my_sound.loadSound("song"+i+".mp3", true);
trace(i);
}
// loop the sound
my_sound.onSoundComplete = function() {
my_sound.start();
};

// --------------------------</load and loop sound>-------------------------- \\

// ------------------------------<Play Stop button function>------------------------------ \\
var playstat:String
playstat = 'on'
control.onRelease = function () {
    if (playstat != 'off') {
        gotoAndStop(2);
        playstat = 'off';
        my_sound.stop();
        musictext.text = "music off";
        //trace (playstat);
    }
    else if (playstat != 'on') {
        gotoAndStop(1);
        playstat = 'on';
        my_sound.start();
        musictext.text = "music on";
        this.switchTrack();
        //trace (playstat);
        trace(songnr);
    }
}
switchTrack();
// ------------------------------</Play Stop button function>------------------------------ \\

Yeah I know, it’s probably the worst mp3 player in history but I’m kinda new to this so I would grately appriciate any help. thx in advance.

[‘song0’]

add more songs:


['song0', 'song1']

for example.