Load SWF inside naviteWindow [AIR]
Hello,
I have an AIR application where I have to load a SWF from a server.
At some point the user will click on a button and that button will create a new nativeWindow.
Inside that nativeWindow we have a stage reference.
I just want to load a SWF, addChild it to the stage and be happy! 😛
But I'm getting this error:
SecurityError: Error #2070: Security sandbox violation: caller http://somewhere.com/swfapp.swf cannot access Stage owned by app:/Teste.swf.
at flash.display::Stage/get stageWidth()
at com.swfapp::MainClass/initApp()
at flash.display::DisplayObjectContainer/addChild()
at flash.display::Stage/addChild()
at NativeWindowSWFLoader/loadSWFURLComplete()
I'm using a normal Loader:
private function loadSWFFromURL():void
{
var context:LoaderContext = new LoaderContext();
context.applicationDomain = ApplicationDomain.currentDomain;
context.securityDomain = SecurityDomain.currentDomain;
context.allowLoadBytesCodeExecution = true;
context.allowCodeImport = true;
loaderSWFURL = new Loader();
loaderSWFURL.contentLoaderInfo.addEventListener(Event.COMPLETE, loadSWFURLComplete);
loaderSWFURL.load(new URLRequest(urlSWF));
}
private function loadSWFURLComplete(e:Event):void
{
//var loaderInfo:LoaderInfo = LoaderInfo(e.target);
//var byteArray:ByteArray = loaderInfo.bytes;
this.stage.addChild(loaderSWFURL);
}
Can someone hep me on this?
Thank you.