I have an image I am pulling in from Facebook. It is running ok but now
that we rotated the image it looks horribly pixelated with a lot of
aliasing. I tried to set bitmap smoothing to true and it resulted in the
famous error:

SecurityError: Error #2122: Security sandbox violation: Loader.content:
http:// cannot access .jpg. A policy file is required, but the
checkPolicyFile flag was not set when this media was loaded.

I found online that Facebook has a policy file and I applied it
successfully using:

            protected function initializeHandler(event:FlexEvent):void
            {
                // allows bitmap smoothing (which we need here)
                Security.loadPolicyFile("
http://profile.ak.fbcdn.net/crossdomain.xml";);
                var context:LoaderContext = new LoaderContext();
                context.checkPolicyFile = true;
                context.applicationDomain = ApplicationDomain.currentDomain;
            }

This is called before the Image source is set. In fact it is in the
initialize event of the Image container component.

But I am wary to upload it to a site where I do not know if it will break
because it is will be in a different security sandbox again.

My question is, is there a way to tell if I can set bitmap smoothing to
true on my images (bc if it is not allowed it will cause fatal errors and
the whole application will explode). In other words, is it possible to tell
if I'm in the correct security sandbox (security policy loaded and was
successful) so I know smoothing is allowed. Does that make sense?

Reply via email to