2

I'm getting a very annoying run time error message, which crashes my flash application when it runs in the browser. The error pertains to a 'Security Sandbox Violation' when I attempt to access Youtube's Gdata api. The exact error message reads:

Error: Request for resource at https://gdata.youtube.com/feeds/api/videos?
key=As##2PVR2#lPj#0bVaw_Tvjx1MI6qeAI1gORxErVYDzu2zZy4D18bf8T6pHxsPgIOhs3_44Te
YTVlYLx49goUPbv00udousA&q=The-Muppets-official-trailer&alt=json&max-results=1 
by requestor from http://###.com/cws/f/VV.swf is denied due 
to lack of policy file permissions.
*** Security Sandbox Violation ***

When I run the SWF locally, everything works fine.

Any ideas?

Thanks.

Edit: I've just added these lines, but still no luck.

Security.loadPolicyFile("http://www.mydomain.com/crossdomain.xml");
Security.loadPolicyFile("https://gdata.youtube.com/crossdomain.xml");
Security.allowDomain("https://gdata.youtube.com");
Security.allowDomain("gdata.youtube.com");
Nick
  • 1,269
  • 5
  • 31
  • 45

1 Answers1

0

You need to specify a crossdomain.xml policy-file according to Adobe Flash security rules.

1) Place the crossdomain.xml at the root directory of your website

2) Example content (not recommended)

    <?xml version="1.0"?>
    <cross-domain-policy>
       <allow-access-from domain="*" />
    </cross-domain-policy>

3) Load the policy-file into your project (AS3):

    System.security.loadPolicyFile("http://www.DOMAIN.net/crossdomain.xml");

Read the reference document for further information.

mate64
  • 9,876
  • 17
  • 64
  • 96
  • Thanks for the reply. Unfortunately it didn't work :( I added the crossdomain.xml file to the root of my website, loaded that policy file, along with youtubes policy file at https://gdata.youtube.com/crossdomain.xml. But I'm still getting the same error. – Nick Mar 12 '12 at 01:06
  • The crossdomain must be set on the domain you are trying to access, not the domain your swf is hosted on. Even if that was the actual problem, this answer won't do the trick, as Nick won't be allowed to change youtube's crossdomain policies. BTW: The existing crossdomain looks totally ok, to be accessed from any .com domain: http://gdata.youtube.com/crossdomain.xml – Pumuckline Mar 12 '12 at 09:36
  • For some reason flash didn't like the https:// versions of the gdata URL. After changing them all to http:// everything worked fine. Thanks for the help. – Nick Mar 12 '12 at 16:55