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>




Reply via email to