4 Replies Latest reply on May 14, 2009 4:17 PM by Flex harUI

    popupmanager hell...

    jonpor Level 1

      Okay to the point.. the popupmanager are creating some strange behaviour.

       

       

      I have a Flex 3 application.  At startup, I use the popupmanager (in a subcomponent of the application) that opens a small window where the user selects an option via one of many buttons  ie. option A, B, C, D.  The buttons are created dynamicly off a data provider. It is a tilewindow that contains a tilelist filled with buttons via a custom renderer.  The buttons are created dynamically via the dataprovider.  Nothing fancy, works fine ie:

      ----------

      |  title   |

      ----------

      | A B C |

      |D E F  |

      ----------

       

      Now.. all my problems started when I tried to put a short informational popup in the main.mxml file of the application.  The flow of events is now that the application loads, it creates a small popup, via the popupmanager, to display information, then  programatically closes it.  After that it manually calls a subcomponent to display the button popup discussed above.  At this point...the button popup no longer works.   The button popup loads, shows the title, but never displays the buttons.  It is like they are not rendering, although if I trace, all the code it run.  As soon as I remove the first popup, it works again.

       

      So recapping.. application starts.  in the main.mxml a popup is displayed, then programatically closed, then the button popup is called to be displayed (via  subcomponent). The button popup now doesn't show the buttons, but shows the title.

       

      What is 'interesting?' is that the first popup is affecting the second.  But as soon as  I remove the first one, the second displays fine.  But after hours of hunting, I have found that if don't show the first popup and instead, programatically add the title window to the display list of the main.mxml, I get the same results in the second popup.Why?  I have no idea?

       

      Anyone have any ideas what could be going wrong  or a related problem?  I would like to post code, but it would be huge.  If I need to clarify something.. I can do that.

        • 1. Re: popupmanager hell...
          Gregory Lafrance Level 6

          After you programmatically close the first popup, set it to null?

          • 2. Re: popupmanager hell...
            Flex harUI Adobe Employee

            Stop it in the debugger, see if the buttons are created and where they are.

             

            Alex Harui

            Flex SDK Developer

            Adobe Systems Inc.

            Blog: http://blogs.adobe.com/aharui

            • 3. Re: popupmanager hell...
              jonpor Level 1

              Yah I checked, in the main application I have a private variable that is an instance of the informational popup at the start.  The instance is created dynamically, displayed as a popup until an event happens, then the popup is removed, then the instance is set to null.  After a call is made to show the popup with buttons.

               

              Tracing yes shows all the button are created.  THe item renderer has a set data so I can confirm it is calling.  And like I said, without the first popup, it works fine.

               

              But.. I did find, when tracing, if I do it slow enough, then the buttons are displayed.  For some reason I think it is some sort of race condition between closing the first popup and showing the second.  But why??  It should be possible to show two at the same time.  Unless perhaps something with modality is creating a problem?  I have no idea.

               

               

              .. in the application.mxml file (psuedo code)....

               

              private infoPopup:InformationalTitleWindow = new InformationalTitleWindow();  //this is a title window with a label.. nothing fancy

               

              init() {

                      PopUpManager.addPopUp( infoPopup, DisplayObject( Application.application ),false);
                      PopUpManager.centerPopUp( infoPopup);

              }

               

              SomeEventHandler ( ) {

                    PopUpManager.removePopUp( infoPopup );

                    infoPopup = null;

                    ComponentInstanceWithButtonPopup.openButtonPopup(); //this is the same idea.. have an instance variable, create it, display it

              }

               

              ====in other component

               

              openButtonPopup() {

                     buttonPopup = new TitleWindowWithTileListWithButtonCustomerRenderer();

               

                     PopUpManager.addPopUp( buttonPopup, DisplayObject( this.parentApplcation),true );

               

              }

              • 4. Re: popupmanager hell...
                Flex harUI Adobe Employee

                If the buttons are there, I would inspect them to see where they are and what size they are.  That might give a clue as to what is causing the problem.

                 

                Alex Harui

                Flex SDK Developer

                Adobe Systems Inc.

                Blog: http://blogs.adobe.com/aharui