I'm pretty new to AS, I've tried for 2 days to find the info on how to do this, but I am unable to.
I have a music community website, of course each member can upload their mp3 files, and a unique playlist.xml gets written for each member in their unique folder, the flash player lives in the root, and the xml lives in the members folder, so I am using the flashvars to call the proper xml, but I have absolutely no clue on how to code the as3 to pick up on the flashvars.
so here is what the object tage in the html looks like
so obviously it's calling for the playlist.xml for the profile being viewed at that moment. (please let me know if I have done this part wrong)
now as I said, I have no idea how to code the action script to read this, I was told to use loaderinfo.parameters .
keep in mind that the player I am using is a prebuilt one, I have modified it to suit another application, but now I want to use the same player for this.
I can't find any info to help me figure out how and what to change, here is the as3 for frame 1
Actionscript Code:
stop();
var myFormat:TextFormat = new TextFormat();
myFormat.color = "0xFFFFFF";
list.setRendererStyle("textFormat", myFormat);
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);
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++;
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;
gotoAndStop(3);
}
and here is the song switching on frame 2
Actionscript Code:
songURL = new URLRequest("mp3_files/" + trackToPlay + ".mp3");
I appreciate any help.