I've made a simple mp3 player that plays tracks loaded from an xml file into a datagrid. Once the data is loaded into the datagrid the user can select a track and play it. Everything works fine until i try to play a track with '&' in its path.
This causes the following error:
Error #2044: Unhandled IOErrorEvent:. text=Error #2032: Stream Error.
I assume this is because the URL appears incorrect to the player. If I simlpy remove the '&' and replace it with '&' the file plays fine?
In my xml file, which is used to populate the datagrid, the location of each file is stored as well as various other information such as artist name, year, genre, path, etc. All '&' values in this xml file appear as '&'
Is there any way to convert these values into a form that my player can read?
Any ideas here would really help me out?
Try decodeURI or decodeURIComponent
Thanks for the help flex harUI but sadly these did not work.
I ended up parsing the string for char i didn't want (i.e. &) and removing it using the method below:
private function handleAmpersand(example:String, ac:ArrayCollection):void
//example = "It's a bird, it's a plane, it's ActionScript Man!";
var replaced:String = example; // Initialize replaced with the original text
while ( replaced.indexOf( "&" ) != -1 )
replaced = replaced.replace( "&", "&" );
I hope this helps someone else out in the future?