Load remote swf and access to stage
Hi,
I'm building a simple AIR app to load a remote swf.
If I load the swf in any browser with Flash installed the app is working as expected.
But if I create a AIR app that uses SWFLoader I get an error :
SecurityError: Error #2070: Security sandbox violation: caller https://localhost:5015/Container.swf cannot access Stage owned by app:/FlexLoader.swf.
at flash.display::Stage/get stageWidth()
I guess this is because the loaded swf is not allowed to access the Stage, so I tried to set the securityDomain of the LoaderContext to SecurityDomain.currentDomain
but I get:
SecurityError: Error #2142: Security sandbox violation: local SWF files cannot use the LoaderContext.securityDomain property. app:/FlexLoader.swf
Is there a way to grant access to the Stage (and probably other stuff) to the loaded SWF ?
<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute"
initialize="init()">
<mx:Script>
function init() {
import flash.system.SecurityDomain;
import flash.system.ApplicationDomain;
/*
Security.allowDomain("*");
Security.allowInsecureDomain("*");
*/
var context:LoaderContext = new LoaderContext();
//context.securityDomain = SecurityDomain.currentDomain;
context.allowLoadBytesCodeExecution = true;
context.applicationDomain = new ApplicationDomain();
contentLoader.loaderContext = context;
contentLoader.source = "https://localhost:5015/ndsconsole/Container.swf";
}
</mx:Script>
<mx:SWFLoader id="contentLoader" trustContent="true" height="100%" width="100%"/>
</mx:WindowedApplication>
Thanks in advance.
Regards.
PS: This is my first post on this forum, let me know if it's not the appropriate one for my question
