Share Posted November 27, 2013 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()[C:\Users\hats\Desktop\teste\NativeWindowSWFLoader.as:93] I'm using a normal SWFLoader: private function loadSWF(url:String):void { holder = new MovieClip(); applicationDomain = new ApplicationDomain(); loaderContext = new LoaderContext(false, applicationDomain); loader = new SWFLoader(url, { context:loaderContext, container:holder, onProgress:progressHandler, onComplete:onCompleteSWFLoader } ); loader.load(); } private function onCompleteSWFLoader(e:Event):void { this.stage.addChild(holder); } Can someone hep me on this?Thank you. Link to comment Share on other sites More sharing options...
Share Posted November 27, 2013 Hi, you may have to seek advice from Adobe regarding those security restrictions. One thing though that is incorrect in your code is that a SWFLoader is not a DisplayObject that can be added to the stage. You would need to add the SWFLoader's content. BAD this.stage.addChild(loader); GOOD this.stage.addChild(loader.content); I would suggest that you create a super simple demo-app using AS3 native Loader(). If you get same error then ask Adobe for some help. Once you confirm that your approach works without SWFLoader then we will be better suited to see and compare what SWFLoader may need to do differently (if anything). Link to comment Share on other sites More sharing options...
Author Share Posted November 27, 2013 Hi, you may have to seek advice from Adobe regarding those security restrictions. One thing though that is incorrect in your code is that a SWFLoader is not a DisplayObject that can be added to the stage. You would need to add the SWFLoader's content. BAD this.stage.addChild(loader); GOOD this.stage.addChild(loader.content); I would suggest that you create a super simple demo-app using AS3 native Loader(). If you get same error then ask Adobe for some help. Once you confirm that your approach works without SWFLoader then we will be better suited to see and compare what SWFLoader may need to do differently (if anything). I'm sorry, i mispelled the correct work... has holder, not loader. holder is a container for the loaded SWF. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now