SecuritySandbox Errors and PaperVision3D
I have been banging my head since past one week to resolve the Security Sandbox error issue with ActionScript 3.0 and Papervision 3D. This security thingy was needed badly to get my FlickrGallery working.
Error Description:
SecurityError: Error #2122: Security sandbox violation: LoaderInfo.content:
file:///C:/Documents and Settings/anup/My Documents/app/Final/bin/Final.swf
cannot access http://farm3.static.flickr.com/2263/2043746131_8e36900f5d_t.jpg.
A policy file is required, but the checkPolicyFile flag was not set when this media
was loaded.
at flash.display::LoaderInfo/get content()
at Final/::imageLoaded()
Anyhow the flash application was not getting the LoaderContext’s checkPolicyFile flag and domain’s crossdomain.xml file. I searched for solutions all over the web including pv3d mailing list and then arrived at a solution for this problem.
My ActionScript 3.0 loader code looks like this:
imageURL = string;
var loaderContext:LoaderContext = new LoaderContext(true);
var imageLoader:Loader = new Loader();
imageLoader.load( new URLRequest(imageURL),loaderContext);
imageLoader.contentLoaderInfo.addEventListener( Event.COMPLETE, imageLoaded );
private function imageLoaded(e:Event):void{
var loadedBmp:Bitmap = e.target.content as Bitmap;
var bmp:BitmapData = loadedBmp.bitmapData;
var material:BitmapMaterial = new BitmapMaterial(bmp);
material.doubleSided = true;
images[imgCounter] = new Plane( material, 40, 40, 1, 1);
rootNode.addChild(images[imgCounter]);
}
I created a proxy script for my domain http://anup.info to route all flickr images through my domain. Found a cool php script at http://www.abdulqabiz.com/blog/archives/general/php_proxy_script_for.php
Then finally added one crossdomain.xml file at http://anup.info
< ?xml version="1.0"?>
< !DOCTYPE cross-domain-policy SYSTEM
"http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
<cross -domain-policy>
<allow -access-from domain="*" />
</cross>>
Bravo! it works! Finally my FlickrGallery is ready to go live on external web sites.
Trackbacks
Use this link to trackback from your own site.



Obagi Blue Peel…
I found your site on technorati and read a few of your other posts. Keep up the good work. I just added your RSS feed to my Google News Reader. Looking forward to reading more from you….