Hello all,
I have a flash music player that plays 3 tracks. Right now, it repeats track 1 unless you click to go to the next track. I want to unite all three tracks so they play one after the other. Here is the flash code:
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 = "TRACK "+numtrack;
}
};
function loader(sound) {
var gbl = sound.getBytesLoaded();
var gbt = sound.getBytesTotal();
tf_txt.text = 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();
};
I would appreciate any help.