0

I have an iframe application in vk.com. I can use their API everything looks fine but when I want to load profile images I get Security Sandbox Error. When I print the result and errors I get This: (I am using Greensock ImageLoader)

MYURL : 'MY Image URL on cs408919 subdomain of vk'
Loading CrossDomain on cs408919
ScriptAccessDenied : Error #2048
SecurityError : Error #2048
Error : Error #2048
ScriptAccessDenied : Error #2123 Security SandBox Violation, No Policy Files Granted Access

It seems to me crossdomain.xml issue but I couldn't find right one. Thanks...

2 Answers 2

1

In additional to fsbmain's answer I want say you have to add following code:

Security.allowDomain("*");
0

Yes, it's crossdomain issue, vk sub-domains for images doesn't provide crossdomain.xml for user avatars, but you still able to load (and add to display list as well) them. What you can't do is to access the loaded content (and set smooth bitmap flag for example, or draw the hole stage with vk images on it).

If you need the access the content you can use this "policy-hack", but it's hack, so it can be fixed in any FP update (I guess even this answer may bring closer this moment:) ):

The idea is to listen the ADDED event if image Loader:

protected var _prepareloaderBitmap:Bitmap;

_prepareloader.addEventListener(Event.ADDED, onPrepareLoader);
_prepareloader.contentLoaderInfo.addEventListener(Event.COMPLETE, onPrepareLoader);

And the listener:

protected function onPrepareLoader(event:Event):void
{
    //event ADDED fired only for Bitmap (not for SWFs)
    if(event.type == Event.ADDED)
    {
        _prepareloaderBitmap = event.target as Bitmap;
    }
    else if (event.type == Event.COMPLETE)
    {
        if(_prepareloaderBitmap)
        {
            trace("loaded image size:", _prepareloaderBitmap.width, "x", _prepareloaderBitmap.height);
        }
    }
}

Having the reference to the loaded Bitmap you can now add it instead of crossdomain issued loader.

1
  • i am now getting images form php file on my servers i hope they will let me do that
    – Kemal Şen
    May 23, 2013 at 8:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.