# Next button for xml mp3 player

**URL:** <https://forum.kirupa.com/t/next-button-for-xml-mp3-player/214673>\
**Category:** flash\
**Created:** [January 31, 2007, 1:05am UTC](https://forum.kirupa.com/t/next-button-for-xml-mp3-player/214673 "2007-01-31T01:05:30Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![rondog](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/rondog/32/2478_2.png) [@rondog](https://forum.kirupa.com/u/rondog)\
**Post date:** [January 31, 2007, 1:05am UTC](https://forum.kirupa.com/t/next-button-for-xml-mp3-player/214673/1 "2007-01-31T01:05:30Z")

</div>

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:

```auto

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:

```auto

// 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?
