Sections
You are here: Home Forum Flash AS3 Failed to load policy file

AS3 Failed to load policy file

Up to Flash

AS3 Failed to load policy file

Posted by Chris Cote at January 19. 2008
I have a lot of experience with flash and xml sockets. I've written my own server and several flash apps which utilize the server. My server returns a valid policy file when the request is made. MCHelper doesn't seem to do that though. Does anyone have any examples of the work around for this. I use Xcode and the flex2 sdk to write and compile my swf's. I used Security.loadPolicyFile() to load a policy file from my local apache server. It loads fine and gets rid of the Security Sandbox error, but i get an OnConnectError. Any ideas I don't have cs3 so i can't view the example files. Maybe if i could just see the as3 code.

Re: AS3 Failed to load policy file

Posted by Chris Cote at January 19. 2008

ok, new error. I was using port 10000 from flash rather than 11000(stupid). so it's at least showing up in the mchelper as a connection now, but now it ignores the policy file because it's got incorrect syntax...

[trace] Ignoring policy file with incorrect syntax: xmlsocket://localhost:11000
[trace] *** Security Sandbox Violation ***

maybe an issue with the new mchelper?

Re: AS3 Failed to load policy file

Posted by Chris Cote at January 19. 2008

wierd. the swf connects when run in safari, but not opera, firefox or from the flash player. I am using the debug player.

Re: AS3 Failed to load policy file

Posted by Chris Cote at January 19. 2008

ok, so to run from the flash player not in a browser. I have it load the policy file from my apache server. this seems to work fine. but is not the most graceful solution. Having to have a server running to host the policy file is not cool. I can't seem to find where the policy file is created in the mchelper source. I would gladly make the change. I see where we add the /0 for flash.

Re: AS3 Failed to load policy file

Posted by Chris Cote at January 19. 2008

also, it does the same thing for 2.0 and 2.1

Re: AS3 Failed to load policy file

Posted by Liam Staskawicz at January 19. 2008
Um, there's no policy file involved as far as I know. I'm not familiar with the Security.loadPolicyFile() business - maybe you can shed some light on what has to happen with this, and we can add it?

Re: AS3 Failed to load policy file

Posted by Chris Cote at January 22. 2008

I'd love to help out Liam. So the process flash goes through when connecting to a socket server.

 

it sends a request to the socket server in question. The url looks like this

    xmlsocket://localhost:11000

 

obviously the port and hostname depend on the server your connecting to

 

the data transmitted to the server comes in xml form and looks like this

 

<policy-file-request/>

 

Flsh then waits for a response from said socket server. It's looking for a policy file. The file must take the form of this

 

<?xml version=\"1.0\"?><cross-domain-policy><allow-access-from domain=\"*\" to-ports=\"11000\" /></cross-domain-policy>\0

 

the asterisk acts as a wild card. it's probably best to leave this wild or add a spot in the preferences to fill it out. and the port should represent the port mchelper is listening on for connections other than the controller.

 

I've noticed some lag in the mchelper socket. it seems to send to flash from the controller just fine, and flash is able to handle the incoming data, but if send repeated data from flash it eventually gets way out of sync. I don't know if this is an issue with the controller or the server.

 

I'm currently writing an OSC server for controller <--> flash(any tcp connection) communication. I'm hoping it's just the server that has the lag and not the controller, but i will find out soon enough. I'll be sure to post it up here as well.

 

One more thing. The Quick reply box doesn't seem to function in Opera, I had to switch browsers to write this. woo, and I'm out.

 

 

Re: AS3 Failed to load policy file

Posted by Liam Staskawicz at January 22. 2008
Chris - sounds easy enough. I can get this into a build relatively easily. Would you mind contacting me via email, and I can perhaps send you a build and get your feedback. liam at makingthings dot com As for the lag, I've noticed that it gets bad when lots of messages are being printed to the dialog window, but if you hide them there it's pretty snappy. This is because the dialog has to synchronize messages coming from all different sources/threads and, as such, is a bit slow. There may be a better way to code the dialog window, but for now the switch in the View menu to hide OSC messages works pretty well.

Re: AS3 Failed to load policy file

Posted by Chris Cote at January 22. 2008

cool, i'll give it a try.

 

 

contacting now

Re: AS3 Failed to load policy file

Posted by Chris Cote at January 26. 2008

So the policy error appears only when using the debug flash player.

Powered by Ploneboard
Document Actions