hi guys. I’m using a loader to load a jpg. After it’s loaded, I want to resize it. Problem is, when I go to resize it, I get a runtime error saying:
SecurityError: Error #2122: Security sandbox violation: LoaderInfo.content: http://address_omitted_here.swf cannot access http://address_omitted_here.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 viewer_fla::MainTimeline/initHandler()
Here’s the code I was using to load it:
function initHandler(e:Event):void {
e.target.loader.x = 0; e.target.loader.y = 0;
if (e.target.content.width > e.target.content.height) {
e.target.content.width = Global.STAGE_WIDTH;
e.target.content.scaleY = e.target.content.scaleX;
e.target.loader.y += (Global.STAGE_HEIGHT - e.target.content.height)/2;
} else if (e.target.content.height >= e.target.content.width) {
e.target.content.height = Global.STAGE_HEIGHT;
e.target.content.scaleX = e.target.content.scaleY;
e.target.loader.x += (Global.STAGE_WIDTH - e.target.content.width)/2;
}
Global.picsLoaded++;
}
for (i=1; i<=Global.NUMPICS; i++)
{
loader = new Loader();
loader.load(new URLRequest(this["p"+i]));
//loader.load(new URLRequest("p"+i+".jpg"));
loader.contentLoaderInfo.addEventListener(Event.INIT, initHandler);
clip.getChildByName("pic"+i).addChild(loader);
clip.getChildByName("pic"+i).alpha = 0;
}
I can load the pictures fine, it’s just when I try to resize them with
e.target.content
that I get the error. How else can I resize the pictures?