Simple mp3 player functions

Excuse the poor syntax and AS etiquette… I don’t really use Flash anymore but have been approached by a client to work on a simple-function mp3 player with play, pause, prev, and next song buttons for their website.

I’m using http://www.flash-db.com/Tutorials/mp3player/ and wanted to learn how to create next and previous song buttons. Here is my code:

this._lockroot = true;


//make textfields autosize
album_txt.autoSize = "left";
//artist_txt.autoSize = "left";
//title_txt.autoSize = "left";


//create sound object
var songInterval:Number;
var amountLoaded:Number;
var mySound:Sound;
var nextTrack:Number;

//this will contain all the track details from the xml file
var tracks_array:Array = new Array();
var totalTracks:Number;

//create the XML object and populate with track details
var jukebox_xml:XML = new XML();
jukebox_xml.ignoreWhite = true;
var RootNode:XMLNode;

jukebox_xml.onLoad = function(success:Boolean) {
    if (success) {
    RootNode = this.firstChild;
    totalTracks = RootNode.childNodes.length;
    populateTracksArray();
    } else {
    trace("error loading xml file");
    }
};
jukebox_xml.load("tracks.xml");

function populateTracksArray():Void{
    for(var i:Number=0; i < totalTracks;i++){
        tracks_array* = RootNode.childNodes*;
        tracks_array*.source = RootNode.childNodes*.attributes.source;
        tracks_array*.artist = RootNode.childNodes*.attributes.artist;
        tracks_array*.album = RootNode.childNodes*.attributes.album;
        tracks_array*.title = RootNode.childNodes*.attributes.title;
        }
        //play first track 
        
        
        
        playTrack(tracks_array[0].source,tracks_array[0].artist,tracks_array[0].album,tracks_array[0].title,true);
        
        //populate list component with song titles
        populateList();
}
function playTrack(source, artist, album, title, stream):Void{
        artist_txt.text = artist + " ~ " + title;
        //album_txt.text = album;
        //title_txt.text = title;
        mySound = new Sound();
        
        mySound.onSoundComplete = function():Void{
            //lets play the next song
    if(playNext==true){
    list_comp.selectedIndex +=1;
    }        
    if(continous_comp.selected){
            if(list_comp.selectedIndex < (totalTracks -1)){
    list_comp.selectedIndex +=1;
    }else{
        list_comp.selectedIndex = 0;
    }
    playTrack(tracks_array
[list_comp.selectedIndex].source,tracks_array
[list_comp.selectedIndex].artist,tracks_array
[list_comp.selectedIndex].album,tracks_array
[list_comp.selectedIndex].title, true);
    }
            }
    
        mySound.loadSound(source,stream);
        clearInterval(songInterval);
        songInterval = setInterval(songProgress,100);
}


//create a listener for the list component
var compListener:Object = new Object();
list_comp.addEventListener("change", compListener);

compListener.change = function(info:Object):Void{
playTrack(info.target.value,tracks_array
[list_comp.selectedIndex].artist,tracks_array
[list_comp.selectedIndex].album,tracks_array
[list_comp.selectedIndex].title, true);
}


//this controls download bar and playback

function songProgress():Void{
    amountLoaded = (mySound.getBytesLoaded()/mySound.getBytesTotal());
    progressbars_mc.downloadbar_mc._width = amountLoaded * 200;
    progressbars_mc.playback_mc._x =  (mySound.position/mySound.duration)*amountLoaded * 200;
    position_txt.text = mySound.position;
    duration_txt.text = mySound.duration;
    playback_txt.text = progressbars_mc.playback_mc._x;
}

//controls
var soundPosition:Number;
var paused:Boolean = false;

controlbar_mc.pause_btn.onRelease = function():Void{
    soundPosition = mySound.position;
    paused = true;
    mySound.stop();
}

controlbar_mc.play_btn.onRelease = function():Void{
    if(paused){
    mySound.start(soundPosition/1000);
    paused = false;
    }
}

controlbar_mc.btn_next.onRelease = function():Void{
    trace("next song");
    playNext=true;
    playTrack();
}

controlbar_mc.btn_prev.onRelease = function():Void{
    trace("previous song");
    playNext=true;
    playTrack();
}

My attempt at setting up the next and previous buttons is at the bottom of the code. Currently, when I click on the next button, it responds and gives me the error “Error opening URL” and it gives me the location to where my player is but shows “undefined” at the end of the location.

Any help?