AS3/XML MP3 Player

Hi guys,

Long time lurker here, love the tutorials and information. I’m a front end graphic designer by definition, but I’m trying to round out my abilities with both back-end programming and flash development at my place of business. I just broke down and joined, because I simply can not find an answer to my problem.

OK… this has been driving me up the wall for the last few days. I recently finished designing and coding an XML driven AS3 MP3 player. The problem is, my .SWF file will not access my XML file. At first, it simply worked in my flash player. Then after changing the publishing settings, I managed to get it to work in my browser locally. However, I still haven’t been able to get it to work properly on test servers.

I’ve tried setting my Local Playback Security to: “Access network only” and “Access local files only” to no avail.

I don’t know if dishing out the code will help, but I’ll do it regardless.

Frame 1


var trackToPlay:String;
var pausePosition:int=0;
var songURL:URLRequest;
var isPlaying:Boolean=false;
var i:uint;
var myXML:XML = new XML();
var XML_URL:String="mp3_playlist.xml";
var myXMLURL:URLRequest=new URLRequest(XML_URL);
var myLoader:URLLoader=new URLLoader(myXMLURL);
myLoader.addEventListener("complete", xmlLoaded);

function xmlLoaded(event:Event):void {

    myXML=XML(myLoader.data);
    // Access song 1 in the XML file to start the player
    var firstSong:String=myXML..Song.songTitle[0];
    var firstArtist:String=myXML..Song.songArtist[0];
    songURL=new URLRequest("mp3_files/"+firstSong+".mp3");
    status_txt.text="1. "+firstSong+" - "+firstArtist;
    for each (var Song:XML in myXML..Song) {

        i++;// Increment the song counter by one
        var songTitle:String=Song.songTitle.toString();
        var songArtist:String=Song.songArtist.toString();
        list.addItem( { label: i+". "+songTitle+" - "+songArtist, songString: songTitle, Artist: songArtist, songNum: i } );

    }
    var myArray=new Array(0,0);
    list.selectedIndices=myArray;// This highlights song 1 by default
    gotoAndStop(3);

}

There’s more on the other 2 frames, but they deal mostly with the players functionality…

Any advice?

Thanks in advance, guys.