Question

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...

Was it helpful?

Solution 2

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.

OTHER TIPS

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

Security.allowDomain("*");
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top