Reputation: 3
i was trying to cache some images in my flash project, for those images could be frequently viewed. the problem is i always got a sandbox violation error. i'm fetching the images with an instance of Loader. i'll show you my source code below:
Security.loadPolicyFile("https://photos-4.dropbox.com/crossdomain.xml");
var loaderContext:LoaderContext = new LoaderContext();
loaderContext.checkPolicyFile = true;
var newLdr:Loader = new Loader();
newLdr.contentLoaderInfo.addEventListener(Event.COMPLETE, onCloudImageComplete);
newLdr.load(new URLRequest(this.thumbUrl), loaderContext);
Here i pasted the error i have:
SecurityError: Error #2123: Security sandbox violation: LoaderInfo.content: http://picapoco.local/swf/poUploader_v3.0.swf cannot access https://photos-4.dropbox.com/t/0/AADzWqfBfPvOfff1q0JaIm7Z5EaG8C1MNd-8Z1yCxaoWDg/12/189302658/jpeg/200x200/1/_/0/4/IMGP7780.JPG/yotcoll2bm4le7h/kpHeca7yyu/IMGP7780.JPG. No policy files granted access.
at flash.display::LoaderInfo/get content()
at picapoco.models::Picture/onCloudImageComplete()
Any clues to help me solve it?
Upvotes: 0
Views: 655
Reputation: 39408
The crossdomain.xml file that you link to only allows connections from *.dropbox.com
. So, you must run your app on a dropbox.com domain in order to access files from a browser based Flash App.
Assuming that you do not work for DropBox and have access to deploy SWFs on the dropbox.com domain, here are a few options:
You could, in theory, upload the SWF to your dropbox account but I do not expect great performance; as dropbox is not designed to be as responsive as a web host.
You could do some work with your local hosts file to serve your SWF off a "dropbox.com" domain. This is not practical for production purposes, but may work for development.
You could deploy your app as an AIR application--either desktop or mobile--to avoid crossdomain issues.
You could use a server side proxy to load the images for you. Your app would call the proxy service, which will in turn load the images from drop box and return the image to your app. This is the most practical option.
Upvotes: 1