flashvars, loaderinfo for mp3 player with xml
ok, I am using flash cs5, am pretty new to as3, and I've been trying for 3 days to figure this out, as of yet have not been able to.
I have built a music community website, obviously members can sign up for an account, and upload mp3 files to their accounts.
now I'll explain in as much detail as I can.
Once registration is complete, the php script creates a folder in the members directory on my server with their unique id, then when they go and upload an mp3, it uploads it to their folder and automatically creates a playlist.xml file for the song(s)
so, I have a prebuilt flash mp3 player that I got from developphp.com, his as3 code calls for a static directory for the audio and xml, now since the flash player will live in the root, and the xml and audio will live in the members/$id folders, I am told to use flashvars and loaderinfo.parameters to do what I need, and that is to load the xml and mp3 files into the player for the profile that is being viewed at that moment, so lets look at what I've put into the html object and embed.
lets use profile #7
<param name="movie" value="flplayer.swf?<?php print"$id/playlist.xml" ?>">
<embed src="flplayer.swf?<?php print "$id/playlist.xml" ?>"> (please tell me if I have done this incorrectly)
now if we go to the profile.php?id=7 page, thius is what the page source looks like:
<param name="movie" value="flplayer.swf?7/playlist.xml">
<embed src="flplayer.swf?7/playlist.xml>">
now here is where I am stuck, as I said the flash mp3 player urlLoader and URLRequest, and I have been searching for days to figure out what I am supposed to do to get the player to pick up on the flash vars, here is the top part of the as3 code where it calls for the mp3 and the xml.
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);
}
I am not asking for free work, I'm just trying to get pointed in the right direction, through searching I have been trying to find out how and what to change, and I have been having a great deal of trouble finding the info, I'm ready to pull my hair out.
