# XML Player

**URL:** <https://forum.kirupa.com/t/xml-player/234815>\
**Category:** flash\
**Created:** [August 6, 2007, 12:37pm UTC](https://forum.kirupa.com/t/xml-player/234815 "2007-08-06T12:37:27Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![AnGHeLL](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/anghell/32/3973_2.png) [@AnGHeLL](https://forum.kirupa.com/u/AnGHeLL)\
**Post date:** [August 6, 2007, 12:37pm UTC](https://forum.kirupa.com/t/xml-player/234815/1 "2007-08-06T12:37:27Z")

</div>

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 😃

This is the AS for every btn:

```auto

on(release){

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

}

```

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

```auto

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 😛
