Newgrounds.com — Everything, By Everyone.

Checking login status…

USERNAME:

PASSWORD:

Logging in…

Logged in as:
.
Logging out…
Inbox My Account Log Out


Forum Topic: Id3/checkpolicyfile (as3 Question)

(321 views • 1 reply)

This topic is 1 page long.

<< < > >>
Questioning

DonutMaster

Reply To Post Reply & Quote

Posted at: 6/15/07 03:10 PM

DonutMaster LIGHT LEVEL 28

Sign-Up: 05/15/05

Posts: 504

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.

BBS Signature

None

DonutMaster

Reply To Post Reply & Quote

Posted at: 6/15/07 10:14 PM

DonutMaster LIGHT LEVEL 28

Sign-Up: 05/15/05

Posts: 504

Nobody knows? :'(

I've been trying a few more things, and I that I'm having the same problem in AS2. I don't know if thats helpful to anybody, it didn't help me any....

The only reasons I can come up with for it not working are that I coded it wrong, or that it just happened to be that Newgrounds and freewebs and the other sites that I tried to access an mp3 from just don't allow swf's from other sites to access id3 data.

BBS Signature

All times are Eastern Daylight Time (GMT -4) | Current Time: 06:22 AM

<< Back

This topic is 1 page long.

<< < > >>
You need a Grounds Gold Account to post on the NG BBS! If you don't have one, click here to sign up now! It's fast, free, and easy — and opens up tons of great NG features!