6 Replies Latest reply on Dec 7, 2011 9:15 AM by activeadico

    SDK 4.6 PopUpManager.centerPopUp broken?

    activeadico

      I am doing something very basic which used to work in 4.0 but seems to be broken in 4.6 (did not try 4.5).

      The titleWindow is launched correctly but now when centered is disappears off the screen (not sure if it moved to a center off the screen or this is an issue with z-index etc) - any insight?

       

      <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"

                                       xmlns:s="library://ns.adobe.com/flex/spark"

                                       xmlns:mx="library://ns.adobe.com/flex/mx"

                                       xmlns:maps="maps.*"

                                       minWidth="900"

                                       minHeight="600"

                                       creationComplete="complete()"                                

                                       >

       

      ....

       

        public function complete() : void

                                    {

                                              var loginFormPopup : LoginForm;

       

                                              loginFormPopup = LoginForm(PopUpManager.createPopUp(DisplayObject(this) , LoginForm , true ));

                                              PopUpManager.centerPopUp(loginFormPopup);

                                    }

       

      Where LoginForm is just a titlewindow:

       

      <mx:TitleWindow

                   xmlns:mx="http://www.adobe.com/2006/mxml"

                                                        xmlns:s="library://ns.adobe.com/flex/spark"

                                                        layout="absolute"

                                                        layoutDirection="rtl"

                                                        direction="rtl"

                            width="400"

                            height="200"

                            horizontalScrollPolicy="off"

                            showCloseButton="false"

      >

      .....

        • 1. Re: SDK 4.6 PopUpManager.centerPopUp broken?
          activeadico Level 1

          I found the issue (which i think is still a bug):

           

          When the TitleWindow is set to layoutDirection="rtl" the centerPopup seems to take it off screen. With layoutDirection="ltr" (or default) the centerPopup behaves correctly.

          • 2. Re: SDK 4.6 PopUpManager.centerPopUp broken?
            Flex harUI Adobe Employee
            1 person found this helpful
            • 3. Re: SDK 4.6 PopUpManager.centerPopUp broken?
              activeadico Level 1

              Thank you Flex harUI - looks like this is it.

                 I am new to your release system - and could not figure out if the fix was rolled out or not.

                 Could you please give me some insight as to when to expect a fix and how I should go about updating my SDK (other than under help menu)?

              thanks

              • 4. Re: SDK 4.6 PopUpManager.centerPopUp broken?
                Flex harUI Adobe Employee

                The fix is not publicly available.  Right now were preparing for moving to an Apache project.  Once we get there we will look at fixes like these and determine when to make to them available.  I believe you had a workaround?  You’ll probably have to go with that for now.

                • 5. Re: SDK 4.6 PopUpManager.centerPopUp broken?
                  activeadico Level 1

                  Flex harUI: Thanks for getting back to me.

                   

                  There is no workaround I know of - simply the least of 2 evils is to use the default layout direction. Since my project is RTL it means that certian things will not look right without custom code for each case.

                  Looking forward for the fix being released.

                  thanks

                  • 6. Re: SDK 4.6 PopUpManager.centerPopUp broken?
                    activeadico Level 1

                    Proposed workaround with emphasis on not changing existing code and simple return to old code once bug is fixed. I did not test extensively and i am novice to Flex - but it seems to work for me.

                    Feedback welcomed.

                     

                     

                    1. Add a preloader to your top level application:

                     

                     

                    <s:Application

                                   xmlns:fx="http://ns.adobe.com/mxml/2009"

                                   ......

                                   preloader="preloaders.ApplicationPreloader"

                                   >

                     

                    2. Then define a preloader and a custom implementation for centering popup.

                     

                    package preloaders

                    {    

                        import mx.core.Singleton;    

                        import mx.preloaders.DownloadProgressBar;

                        import managers.*;

                     

                        public class ApplicationPreloader extends DownloadProgressBar    

                        {          

                            private static var classConstructed:Boolean = staticInitializer();

                     

                            private static function staticInitializer():Boolean        {            

                                Singleton.registerClass("mx.managers::IPopUpManager", Class(managers.RTLPopUpManagerImpl));  

                                return true;        

                            }      

                        }  

                    }

                     

                     

                    package managers

                    {    

                        import mx.managers.PopUpManagerImpl;

                        import mx.managers.IPopUpManager;

                        import mx.core.IFlexDisplayObject;

                     

                        public class RTLPopUpManagerImpl extends PopUpManagerImpl    

                        {          

                             static private var instance : IPopUpManager;

                     

                             static public function getInstance():IPopUpManager

                             {

                                 if ( !instance ) instance = new RTLPopUpManagerImpl();

                                 return instance;

                             }

                     

                     

                            override public function centerPopUp(popUp:IFlexDisplayObject):void       

                            {            

                                popUp.x = popUp.parent.x + (popUp.parent.width / 2) - (popUp.width / 2);

                                popUp.y = popUp.parent.y + (popUp.parent.height / 2) - (popUp.height / 2); 

                            }      

                        }  

                    }