简体   繁体   中英

Why am I receiving a flash player security error when trying to access facebook graph api photos?

I'm using the flash debug player(version 16) and I'm trying to access a users photo from within flash as3. Firstly, the Security error i'm receiving, here it is.

SecurityError: Error #2122: Security sandbox violation: Loader.content: http s://graffiti-galore.herokuapp.com/fb/GraffitiGalore.swf?build=0001 cannot access http s://fbcdn-profile-a.akamaihd.net/hprofile-ak-xfp1/v/t1.0-1/c46.46.570.570/s50x50/398269_10152199084495525_2139734276_n.jpg?oh=29be37fd74f7d338a7b5c23b9aadd474&oe=5548F552& gda =1431395518_d142c304e8b8afa8df340e6cac093b29. A policy file is required, but the checkPolicyFile flag was not set when this media was loaded. at flash.display::Loader/get content() at PictureBox/onCompleteLoadingImage()

I'm using the free Heroku dino that is being offered and I'm simply doing a fetch call to the graph api users object. fetching the id,first_name, last_name,picture.

The picture url comes back as hosted on https facebook servers.

https://fbcdn-profile-a.akamaihd.net/hprofile-ak-xfp1/v/t1.0-1/c46.46.570.570/s50x50/398269_10152199084495525_2139734276_n.jpg?oh=29be37fd74f7d338a7b5c23b9aadd474&oe=5548F552& gda =1431395518_d142c304e8b8afa8df340e6cac093b29

Links like the one above. For some reason i'm receiving this Security error whenever loading up the image from my flash as3 facebook app.

Below is the code i'm using to fetch the image.

[code] public function setupPhoto(url:String):void { removeAllChildren();

        var urlRequest1:URLRequest = new URLRequest(url);

        this.loader1 = new Loader();

        this.loader1.contentLoaderInfo.addEventListener(Event.COMPLETE, onCompleteLoadingImage);
        this.loader1.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, onErrorLoadingImage);

        this.loader1.load(urlRequest1);

        //imageLoader = new ImageLoader(url);
        //imageLoader.addEventListener(Event.COMPLETE, onCompleteLoadingImage);
        //imageLoader.load();

    }

    private function onErrorLoadingImage(e:IOErrorEvent):void 
    {
        debugPanel.writeLine("ERROR LOADING IMAGE!!!");
        debugPanel.writeLine(e.text);
    }
    public function onCompleteLoadingImage(e:Event):void
    {
        //var sprite:Sprite = this.loader1.content as Sprite;
        //updatePicture(sprite);
        updatePicture1(this.loader1.content);
    }

[/code]

this works for me with Facebook:

var lc:LoaderContext = new LoaderContext(true, null, null);
// now add the LoaderContext to your loader
this.loader1.load(urlRequest1, lc);

you don't have to create a LoaderContext every time, just create it once and use everywhere.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM