A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Policy file error while loading images from Facebook

  1. #1
    Junior Member
    Join Date
    Jan 2010
    Posts
    13

    Policy file error while loading images from Facebook

    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 cannot access 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');
    Security.allowDomain('http://profile.ak.fbcdn.net');
    Security.allowInsecureDomain('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");
    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 images are from 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)

  2. #2
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    It looks like you are trying to load a policy file from api.facebook.com, but your images are from profile.ak.fbcdn.net. That policy file on facebook.com is on an unrelated domain (as far as flash knows), so it cannot grant access to things on fbcdn.net.

    The allowDomain and allowInsecureDomain calls allow things loaded from profile.ak.fbcdn.net to access things in the swf, not the other way around.

    You need to load a policy file from profile.ak.fbcdn.net to grant access to things on that server. Fortunately, it seems that the default crossdomain at that server ( http://profile.ak.fbcdn.net/crossdomain.xml ) grants access to all domains.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center