XML Video Playlist Shuffle

Hello,

I have an xml video playlist that playes flv files in sequential order, one after the other. I am trying to make the playlist play random flv files (shuffle the playlist).

Could someone please help me to achieve this shuffle feature?

This is the code I have so far:

//Create NetConnection object
var nc:NetConnection = new NetConnection();
nc.connect(null);

var ns:NetStream = new NetStream(nc);

theVideo.attachVideo(ns);

//Create array to hold all videos
var videos_array:Array = new Array();
var totalVideos:Number;
var duration:Number;

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

videos_xml.onLoad = function(success:Boolean) {
if (success) {
RootNode = this.firstChild;
totalVideos = RootNode.childNodes.length;
populateVideosArray();
} else {
trace(“error loading xml file”);
}
};
videos_xml.load(“videos.xml”);

function populateVideosArray():Void{
for(var i:Number=0; i < totalVideos;i++){
videos_array* = RootNode.childNodes*;
videos_array*.url = RootNode.childNodes*.attributes.url;
videos_array*.desc = RootNode.childNodes*.attributes.desc;
}

//play first track 
ns.play(videos_array[0].url,videos_array[0].desc);

//Iterate through array & add videos to list box
for(i=0;i&lt;totalVideos;i++) {
    videoList.addItem(videos_array*.attributes.desc,videos_array*.attributes.url);
}

/////////////////////////////////
/*This is what i need to work!!*/
/////////////////////////////////


ns.onStatus = function(info) {
if(videoList.selectedIndex &lt; (totalVideos -1)) {
    if (info.code == "NetStream.Play.Stop") {
        videoList.selectedIndex += 1;
        ns.play(videoList.getItemAt(videoList.selectedIndex).data);
    }
}

};
//function:playNextVideo();
//if(videoList.selectedIndex < (totalVideos -1)) {

   // if(the video has finished playing) {

           // videoList.selectedIndex += 1;
          //  ns.play(videoList.getItemAt(next child node).data);
      //  }else {
       //     videoList.selectedIndex = 0;
      //  }
//}

}

//Stop/Start video
playButton.onRelease = function() {
    ns.pause();
}

//call videoStatus() 10 times a second
var videoInterval = setInterval(videoStatus,100);
var amountLoaded:Number;

ns["onMetaData"] = function(obj) {
    duration = obj.duration;
    }

function videoStatus() {
    amountLoaded = ns.bytesLoaded / ns.bytesTotal;
    loader.loadbar._width = amountLoaded * 210;
    loader.scrub._x = ns.time / duration * 210;
    }



//Create listener object to respond to changes
var vidList:Object = new Object();

//Set up change event when user selects different video
vidList.change = function() {
    //get URL of currently selected item
    ns.play(videoList.getItemAt(videoList.selectedIndex).data);
}
//Register listener object to receive events from videoList
videoList.addEventListener("change",vidList);

Thanks