The main idea was create a mp3 player type thing and show some info on the songs playing in my swf. It turns out that the swf works fine when its on my computer or anyone elses computer, but once on a server (such as denvish or freewebs) the id3 of the song like artist and song name isn't obtained.
Thanks to some other people trying it, I found out that sometimes you get an error, “SecurityError: Error #2122: Security sandbox violation” Apparently in the new version of Flash once your swf is on a server you cannot access data from other websites, without using something called checkPolicyFile.
So I changed my code, added that checkPolicyFile thing (I don't really get what it is, but I read in livedocs and other places that you have to set that to true) and it still doesn't display the id3 info.
Code:
var sndChannel:SoundChannel;
var context:SoundLoaderContext = new SoundLoaderContext();
context.checkPolicyFile = true;
var urlReq:URLRequest = new URLRequest("http://www.website.com/music/song .mp3");
var sound:Sound = new Sound();
sound.load(urlReq, context);
sound.addEventListener(Event.ID3, Inf);
function Inf(event) {
var moosic:String = event.target.id3.songName;
var artist:String = event.target.id3.artist;
namebox.text = (moosic + " by " + artist);
}
sound.addEventListener(ProgressEvent.PROGRESS , loading);
sound.addEventListener(Event.COMPLETE, finish);
function loading(event:ProgressEvent) {
var loaded:Number = Math.round(100 * (event.bytesLoaded / event.bytesTotal));
ltext.text = loaded.toString()+"%";
}
function finish(event) {
sndChannel = sound.play();
}
Also, the original song I had being played was a song from the Audio Portal. I thought maybe it was just something with Newgrounds, so tried a song from someplace else and it still wouldn't work.
Any help would be appreciated, I've been trying to get this to work for awhile now.
Example: http://denvish.net/ulf/150607/54290_testness.
php - if you save this to your computer and give it access to the internets, It will show the song name and artist.