XML Player

Hi ppl
I almost done my xml player but i got a problem
I can’t figure out how to play a simple song. I’ve got 5 buttons and everyone load a different song, the thing is that the AS load at every button the next song… so if I click on btn1 loads song2, if I click again on btn1 loads song3 and so on, also if I click en btn2 after 2 clicks on btn1 it loads song4. What i want its that every btn load an only song and nothing else but I can’t do it :smiley:

This is the AS for every btn:


on(release){

    if (trackNum < (totalTracks - 1 )){
    trackNum = trackNum + 1;
    changeTracks();
    
    }

}

And this is the AS for the xml and data load:


XML.prototype.ignoreWhite = true;

var audiolist_xml = new XML();
audiolist_xml.load("playlist.xml");
audiolist_xml.onLoad = function(success){
    if (success) {
        
        songFilePath = new Array();
        songTitle = new Array();
        songBand = new Array();
        eachTrack = new Array();
        eachTrack = this.firstChild.childNodes;
        totalTracks = eachTrack.length;
        
        var i = 0;
        
        while ( i < totalTracks ){
            
            songFilePath.push(eachTrack*.attributes.path);
            songTitle.push(eachTrack*.attributes.titles);
            songBand.push(eachTrack*.attributes.bands);
            
            i = i + 1;
        }    
        trackNum = 0;
        currentFilePath = songFilePath[trackNum];
        currentTitle = songTitle[trackNum];
        currentBand = songBand[trackNum];
    } 
}

function changeTracks(){
    
    currentFilePath = songFilePath[trackNum];
    currentTitle = songTitle[trackNum];
    currentBand = songBand[trackNum];
    mysound.loadSound(currentFilePath, true);
    mysound.start();
}

Thankz in advance :stuck_out_tongue: