Skip to main content
DJ Gecko
Inspiring
December 6, 2008
Answered

System.security.loadPolicyFile

  • December 6, 2008
  • 6 replies
  • 1636 views
Hi, I'm attempting to load a crossdomain.xml file from a folder. I have an ad banner and my client wants all the jpgs and xml file to live on amazon's s3 server, so I of course need a crossdomain.xml file. But it can't live on the root of the domain. So I've tried using System.security.loadPolicyFile(" http://s3.amazonaws.com/theirfolder/crossdomain.xml");
but this isn't working. I've put the .swf on another server, added that domain to the crossdomain.xml file, then tested it. In my browser activity window I see that the swf is loading http://s3.amazonaws.com/theirfolder/crossdomain.xml, but it is also looking for http://s3.amazonaws.com/crossdomain.xml. And my xml file and jpgs aren't loading.

Does anyone have any advice? The ad must be in AS2, Flash 8.

My code is just this line on the .swf's main timeline:
System.security.loadPolicyFile(" http://s3.amazonaws.com/theirfolder/crossdomain.xml");

am I missing something?

Thanks!
This topic has been closed for replies.
Correct answer DJ Gecko
So dropping System is the trick.

ex: Security.loadPolicyFile(' http://www.whateverDomain/somefolder/crossdomain.xml');

cool. Thanks!

6 replies

xchanin
Participating Frequently
April 2, 2009
Glad I could help you out.
xchanin
Participating Frequently
April 2, 2009
Yeah I don't have any issue with a sub-directory either.
DJ Gecko
DJ GeckoAuthorCorrect answer
Inspiring
April 2, 2009
So dropping System is the trick.

ex: Security.loadPolicyFile(' http://www.whateverDomain/somefolder/crossdomain.xml');

cool. Thanks!
xchanin
Participating Frequently
April 2, 2009
Well are you granting access from your domain in the cross-domain file?

In my case I have data(videos, images, etc) stored on a content delivery network, so I don't have access to the root itself, so when I request data from my secured server to the CDN I use Security.loadPolicyFile(' http://www.whateverDomain/crossdomain.xml'); dropping the 'System.' off the loaPolicyFile line and everything works; it never keeps looking for an additional policy file.
DJ Gecko
DJ GeckoAuthor
Inspiring
April 2, 2009
I hadn't noticed that you removed System. Have you successfully loaded a crossdomain file from a sub directory?

ex: Security.loadPolicyFile(' http://www.whateverDomain/somefolder/crossdomain.xml');

Thanks!
xchanin
Participating Frequently
April 2, 2009
This is what I use and I don't have any issues with it.

Security.loadPolicyFile(' http://www.whateverDomain/crossdomain.xml');

DJ Gecko
DJ GeckoAuthor
Inspiring
April 2, 2009
yes that works, but if you read this whole post, the issue is that this doesn't work:

Security.loadPolicyFile(' http://www.whateverDomain/somefolder/crossdomain.xml');

and according to Adobe's documentation, it is suppose to work.
April 2, 2009
I'm having exactley the same problem as Andrei1. Anyone found a solution to this?
DJ Gecko
DJ GeckoAuthor
Inspiring
April 2, 2009
I wish I could help but I haven't been able to get System.security.loadPolicyFile() to work, and can't find anyone who has. Anyone at Adobe able to help us?
Inspiring
December 7, 2008
Does crossdomain.xml exist in theirfolder? I assume it does.

I checked http://s3.amazonaws.com/crossdomain.xml and, unfortunately, it loads an xml. I am not sure but Flash may interpret it differently than if crossdomain.xml did not exist and there was, say, 404 error.

Also, you may want to try to change the order of loading xmls - your crossdomain after Flash attempts to load http://s3.amazonaws.com/crossdomain.xml to override it.

DJ Gecko
DJ GeckoAuthor
Inspiring
December 14, 2008
Thanks for your reply. I moved the files to my server for testing. And I noticed that even though I have:

System.security.loadPolicyFile(" http://mysite.com/clientfolder/crossdomain.xml");

I see in my browser's activity window that the .swf does load http://mysite.com/clientfolder/crossdomain.xml first, but then tries to load http://mysite.com/crossdomain.xml, which does not exist. And I still can't load in any files. When I move I move the crossdomain.xml to my servers root ( http://mysite.com/crossdomain.xml), it works. My .swf doesn't seem to be listening to System.security.loadPolicyFile. Any clues?

Thanks!

Inspiring
December 15, 2008
Try to load first xml from domain root and then from the folder. In other words - make two lines for loading policies. I don't like it but it is worth trying:

System.security.loadPolicyFile(" http://mysite.com/crossdomain.xml");
System.security.loadPolicyFile(" http://mysite.com/clientfolder/crossdomain.xml");

This way it will, hopefully, override loading from the root.