A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: A policy file is required, but the checkPolicyFile flag was not set when this media w

  1. #1
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244

    A policy file is required, but the checkPolicyFile flag was not set when this media w

    Ok how do I fix this?

    Loading image data from remote server (allowed). Works local but not online. I'm using an Image loader class.

  2. #2
    Senior Member calmchess's Avatar
    Join Date
    Sep 2006
    Location
    Earth
    Posts
    2,588
    you have to add context to the loader......

    PHP Code:
    import flash.system.LoaderContext;

            var 
    context:LoaderContext;
            var 
    loader:Loader

    context 
    = new LoaderContext();
    context.checkPolicyFile true;

    loader.load(new URLRequest("http://www.mydomain.com/Images/4pic.png"),context); 
    the above code is not meant to be copied and pasted directly you will have to sort it out into your class file.
    ~calmchess~

  3. #3
    Junior Member
    Join Date
    Jan 2010
    Posts
    13
    @calmchess: I challenge that your reply is WRONG. I've been tackling this same query and it still does not work. Here is the specifications of the problem (similar to blanius - but more detail)

    I am 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)

  4. #4
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244
    OK thanks dude, I'll have to dump the class, not a big deal just convenient.
    Sheez why do they make it so complicated anyway!
    I read the Adobe docs on LoaderContext but didn't see how to link it to the loader.

  5. #5
    Senior Member calmchess's Avatar
    Join Date
    Sep 2006
    Location
    Earth
    Posts
    2,588
    shrugs i don't know blanius I just had the same problem as you added the above code to my loader and the problem of loading images dissapeared.....worked for me sorry it didn't work for you.
    ~calmchess~

  6. #6
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244
    Oh I think it will work, I was using a image loader class that made loading images easier, so I'll have to not use it here and do it manually which is probably what you are doing.

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