Kirupians,
With a looming deadline for a big project, I’ve just wasted an entire evening trying to find out why my application won’t properly load image content when the .swf is deployed to a web server.
Here’s what I’m trying to do:
- load a jpeg image from a different domain than where my .swf’s are hosted
- turn it into a Bitmap object to apply smoothing
Loading the jpeg itself is no problem, as long as I do this:
[AS]addChild(loader);[/AS]
As soon as I try to access loader.content, or **loader.contentInfo.content **to create a Bitmap, Flash simply aborts the script.
So there you have it: a typical security sandbox violation (although no error is ever thrown). Solution: crossdomain.xml! Or that’s what I thought.
Now the image host has a crossdomain.xml in it’s root, with *.rocketclowns.com as an entry. I’m testing my app from www.rocketclowns.com.
Even if I try to force load the policy file:
[AS]Security.loadPolicyFile()[/AS]
Or, with LoaderContext:
[AS][COLOR=#808080]// create a loader context that[/COLOR]
[COLOR=#808080]// checks for policy files[/COLOR]
[COLOR=#000000]var[/COLOR] context:LoaderContext = [COLOR=#000000]new[/COLOR] LoaderContextCOLOR=#000000[/COLOR];
context.[COLOR=#000080]checkPolicyFile[/COLOR] = [COLOR=#000000]true[/COLOR];
[COLOR=#808080]// use the context with your call to load[/COLOR]
myLoader.[COLOR=#0000FF]load[/COLOR][COLOR=#000000]([/COLOR]request, context[COLOR=#000000])[/COLOR];[/AS]
…I still can’t access my loader.content. Help! Is there anything I’ve overlooked, or am I missing something?
Thanks in advance,
0L4F