2 Replies Latest reply on Nov 27, 2009 12:51 PM by dquelch

    PopupButton issue



        I'm quite new to Flex and this may be a more generic question than one specific to PopupButton, but that is the context with which I'm using it in.


      I'm using a PopupButton to trigger the popup of a separate panel (defined in a different mxml file).  It seems that the first time the button is pressed, there is a slight delay (I'm assuming the panel is being created the first time), then the panel pops up.  If I close the panel and then select the popup button again, it comes up immediately.  The issue is that the first time it is created, any effects that I use during the 'popping up' of the panel are not visible because the panel is being created, and I'm guessing by the time it is created, the effects have already been run and thus have no affect.  Subsequent calls to bring up the panel work fine (effects are visible).


      I'm guessing the main problem is that because my panel is defined in a different mxml file than the one the PopupButton is defined in, it is only created when it's first needed which causes the delay the first time through.


      My question is, is there a work-around for this?  I suppose I could bring the panel code into the PopupButton's mxml file, but I'm trying to keep my code modular.  Or is there a way to pre-load the panel's mxml file so when it's needed, it will already be loaded?  Or, can I pause the 'popup process" until the panel has been created?   Thank you in advance for any insight!




        • 1. Re: PopupButton issue
          Gregory Lafrance Level 6

          Have an instance of the panel being popped up instantiated in the file where the popupbutton is.


          private var myPanel:MyFancyPanel = new MyFancyPanel();


          That way it exists and is instantiated when you wish to popit up.


          If this post answers your question or helps, please mark it as such.

          1 person found this helpful
          • 2. Re: PopupButton issue
            dquelch Level 1

            Thanks.  Unfortunately that doesn't seem to have made too much difference. I moved the instantiation code up into the actionScript and I can see the panel code getting initialized prior to me pressing the PopupButton, but the panel still just "appears" the first time it comes up.  Subsequent times it pops up using the easingFunction I designated for it.