Ok right now I have the mp3 player somewhat working. My next button is giving me issues. To solve the fact of hiting previous when you are at song[0] I have this checkPrev function:
var titles:Array = new Array();
var totalNodes:Number;
trackTitle.autoSize = true;
audioxml.ignoreWhite = true;
audioxml.onLoad = function() {
totalNodes = this.firstChild.childNodes.length;
for (i=0; i<totalNodes; i++) {
songs.push(this.firstChild.childNodes*.attributes.src);
titles.push(this.firstChild.childNodes*.firstChild.nodeValue);
}
startMP3(count);
};
function checkPrev() {
if (count == 0) {
prevBtn.gotoAndStop("prevUp");
prevBtn.enabled = false;
} else {
prevBtn.enabled = true;
}
}
audioxml.load("audiofeed.xml");
var mp3:Sound = new Sound();
function startMP3(songNum:Number):Void {
checkPrev();
mp3.loadSound(songs[songNum], true);
trackTitle.text = titles[count];
mp3.onSoundComplete = function():Void {
count++;
if (count<totalNodes) {
startMP3(count);
} else {
count = 0;
startMP3(count);
}
}
}
So that code plays and disables the prev button if count == 0. I wanted to do the same for the next button meaning something like this:
// totalNodes is a var i defined above this code: 'totalNodes = this.firstChild.childNodes.length;'
function checkNext() {
if (count == totalNodes) {
nextBtn.gotoAndStop("nextUp");
nextBtn.enabled = false;
} else {
nextBtn.enabled = true;
}
}
So basically if count == the length of the playlist disable the next button. Well it isnt working for some reason. Any ideas?