0
votes

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]

1
I forgot to mention the url for the crossdomain file is located here, fbcdn-profile-a.akamaihd.net/crossdomain.xmlRicky Mossip

1 Answers

1
votes

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.