And... With what use-case would the loaderContext be used?
--- In [email protected], "jamesfin" <james.alan.finni...@...> wrote: > > Thanks for the feedback. Ironically, I had just found the > systemManager.getSandboxRoot() reference and was putting it in to test! > > While on the same subject, is systemManager.topLevelSystemManager used in a > non-sandboxed-sub-app? > > I'll blog this for sure as it was quite a hike around the mountain. > > Thx again! > > --- In [email protected], Alex Harui <aharui@> wrote: > > > > Couple of things: > > > > > > 1. You should not be setting a loaderContext. It doesn't affect this > > test case, but it is not recommended practice. Set loadForCompability=true > > BEFORE you call load(). I modified your init() function to look just like > > this: > > > > private function init():void{ > > > > loader.loadForCompatibility = true; > > loader.load("SubAppTestChild.swf"); > > } > > > > 2. I thought the original goal was to get the sub-apps popup to center in > > the main app, but the code looked like the goal was to center between two > > lines. If the goal is to center in the main app, I adjusted the code to > > look like this: > > > > public function loadDialog():void{ > > var test:TestView = > > PopUpManager.createPopUp(systemManager.getSandboxRoot(), TestView, true) as > > TestView; > > PopUpManager.centerPopUp(test); > > } > > > > > > > > On 2/1/10 11:32 AM, "jamesfin" <james.alan.finnigan@> wrote: > > > > > > > > > > > > > > I've been trying to center a dialog in a sub application but haven't had > > any success. All SubApplication experts can pitch-in here... > > > > Backgrounder...SubApps are cool because two SWF's can be compiled with > > different SDK's and can still work together. > > > > The upper/left-hand corner of the dialog appears between the two HRule's > > because that is where the SWFLoader resides in the parent MXML. The dialog > > isn't clipped in any way. > > > > I've tried many combinations to get the dialog to center but it won't budge. > > > > For a quick demo... > > > > http://71.36.29.20:8888/SubAppTestParent.html > > > > Parent Source... > > > > <?xml version="1.0" encoding="utf-8"?> > > <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" > > applicationComplete="init()" preinitialize="preinit()"> > > > > <mx:Script> > > <![CDATA[ > > import mx.controls.SWFLoader; > > import mx.managers.SystemManager; > > import mx.events.FlexEvent; > > import mx.managers.PopUpManager; > > > > private function preinit():void{ > > // Security.allowDomain("*"); > > } > > > > private function init():void{ > > > > var context:LoaderContext = new LoaderContext(); > > context.securityDomain = SecurityDomain.currentDomain; > > context.applicationDomain = new ApplicationDomain(); > > loader.loaderContext = context; > > loader.load("http://71.36.29.20:8888/SubAppTestChild.swf"); > > loader.loadForCompatibility = true; > > loader.trustContent = true; > > } > > > > private function testChild(event:MouseEvent):void{ > > (loader.content as Object).application.loadDialog(); > > } > > > > ]]> > > </mx:Script> > > > > <mx:VBox width="100%"> > > <mx:HBox width="100%"> > > <mx:Button click="testChild(event)" label="Open SubApplication"/> > > <mx:Text text="The popup top/left corner should be between the two HRule > > lines"/> > > </mx:HBox> > > <mx:HRule width="100%"/> > > <mx:SWFLoader id="loader"/> > > <mx:HRule width="100%"/> > > </mx:VBox> > > > > </mx:Application> > > > > Child Source... > > > > <?xml version="1.0" encoding="utf-8"?> > > <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" > > preinitialize="preinit()" viewSourceURL="srcview/index.html"> > > > > <mx:Script> > > <![CDATA[ > > > > import mx.managers.PopUpManager; > > > > private function preinit():void{ > > // Security.allowDomain("*"); > > } > > > > public function loadDialog():void{ > > var test:TestView = PopUpManager.createPopUp(Application.application as > > DisplayObject, TestView, true) as TestView; > > PopUpManager.centerPopUp(test); > > } > > > > ]]> > > </mx:Script> > > </mx:Application> > > > > > > > > > > > > > > -- > > Alex Harui > > Flex SDK Team > > Adobe System, Inc. > > http://blogs.adobe.com/aharui > > >

