# Policy file error while loading images from Facebook

**URL:** <https://forum.kirupa.com/t/policy-file-error-while-loading-images-from-facebook/303569>\
**Category:** flash\
**Created:** [January 22, 2010, 12:59pm UTC](https://forum.kirupa.com/t/policy-file-error-while-loading-images-from-facebook/303569 "2010-01-22T12:59:43Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mhb11](https://avatars.discourse-cdn.com/v4/letter/m/858c86/32.png) [@mhb11](https://forum.kirupa.com/u/mhb11)\
**Post date:** [January 22, 2010, 12:59pm UTC](https://forum.kirupa.com/t/policy-file-error-while-loading-images-from-facebook/303569/1 "2010-01-22T12:59:43Z")

</div>

Hi,

I making a game leaderboard on facebook. I’m not using f-connect but working inside the canvas. When I try to load the images from facebook it gives me the following error:

SecurityError: Error #2122: Security sandbox violation: Loader.content: [http://test](http://test) cannot access [http://profile.ak.fbcdn.net/v22941/2...10588\_2173.jpg](http://profile.ak.fbcdn.net/v22941/2...10588_2173.jpg)  
A policy file is required, but the checkPolicyFile flag was not set when this media was loaded.

Here is my loader code

public var preLoader:Loader;  
preLoader=new Loader();  
**update**  
Security.loadPolicyFile(‘[http://api.facebook.com/crossdomain.xml](http://api.facebook.com/crossdomain.xml)’);  
Security.allowDomain(‘[http://profile.ak.fbcdn.net](http://profile.ak.fbcdn.net)’);  
Security.allowInsecureDomain(‘[http://profile.ak.fbcdn.net](http://profile.ak.fbcdn.net)’);  
**update-end**

public function imageContainer(Imagewidth:Number,Imageheight:Numbe r,url:String,path:String) {  
preLoader=new Loader();

Security.loadPolicyFile(“[http://api.facebook.com/crossdomain.xml](http://api.facebook.com/crossdomain.xml)”);  
var context:LoaderContext = new LoaderContext();  
**context.checkPolicyFile = true;**  
context.applicationDomain = ApplicationDomain.currentDomain;

preLoader.load(new URLRequest(path),context);

Any Ideas? I am importing the right class though.

UPDATE: I am loading the images from a different domain say , calling func [http://fahim.com](http://fahim.com) images are from [http://profile.ak.fbcdn.net/v22941/2...10588\_2173.jpg](http://profile.ak.fbcdn.net/v22941/2...10588_2173.jpg)  
something ( I have made sure the pictures are static and do not require a facebook login or anything , they are just user public profile pictures)
