11 Replies Latest reply on Mar 9, 2009 5:15 PM by injpix

    Hw to make a PopUpButton item modal

    IanCWatkins
      Hi All,

      Using PopUpButton to display a TitleWindow. All is working fine and as I expected.

      Is there a way to make the TitleWindow modal ?

      Cheers

      Ian
        • 1. Re: Hw to make a PopUpButton item modal
          injpix Level 3
          Navigate to: Visual Components > Containers > TitleWindow

          Component Explorer
          • 2. Re: Hw to make a PopUpButton item modal
            injpix Level 3
            Did that helped?

            You need to flag the modal param in the PopUpManager.createPopUp()
            • 3. Re: Hw to make a PopUpButton item modal
              IanCWatkins Level 1
              Sorry, no, that didn't help. :-(

              I am using a PopUpButton to slide out a TitleWindow, I am not using PopUpManager to display a TitleWindow, where I know you can set modal as a property.


              • 4. Re: Hw to make a PopUpButton item modal
                injpix Level 3
                Hmm...I am not sure if I follow what you are trying to accomplish. You want a TitleWindow with a modal, sliding out of... exactly where? Is it sliding out from a side of the application? You can still use the PopUpManager and animate in the TitleWindow with a mx.effects class. That class should be assigned in the TitleWindow's showEffect().
                • 5. Re: Hw to make a PopUpButton item modal
                  IanCWatkins Level 1
                  Sliding out from where exactly ? From the PopUpButton, as I have said.

                  Basically have several configuration TitleWindows, each sliding down from PopUpButtons in an ApplicationControlBar.

                  They are sliding, all the controls are displaying correctly, config changes are being picked up by main app OK etc. etc.

                  Just simply wanted to know if it was possible to make a TitleWindow displayed in this way modal.

                  I am trying to avoid PopUpManager if at all possible due to problems getting some complex data types backwards and forwards between them and the main app.


                  • 6. Re: Hw to make a PopUpButton item modal
                    injpix Level 3
                    "Sliding out from where exactly ? From the PopUpButton, as I have said."

                    You never said *where* previously. You mentioned, "a PopUpButton to slide out a TitleWindow" and "PopUpButton to display a TitleWindow". But never *where* this TitleWindow will appear.

                    I suppose you can apply a mx.effects.Blur to a Bitmap. Then have your TitleWindow above this.
                    • 7. Re: Hw to make a PopUpButton item modal
                      IanCWatkins Level 1
                      Apologies myIP, I thought saying that I'm using a PopUpButton to display a component would have been clear that it is displaying by sliding out from that button (just like a combobox etc.).

                      I'm grateful for your pointers. :-)

                      Setting a Blur would give the TitleWindow the appearance that it is modal, but wouldn't actually make it modal.

                      I actually need the TitleWindow to be modal so I can force validation of data entered before it closes.

                      Cheers

                      Ian
                      • 8. Re: Hw to make a PopUpButton item modal
                        Level 7

                        "IanCWatkins" <webforumsuser@macromedia.com> wrote in message
                        news:gop2rf$1qd$1@forums.macromedia.com...
                        > Sliding out from where exactly ? From the PopUpButton, as I have said.
                        >
                        > Basically have several configuration TitleWindows, each sliding down from
                        > PopUpButtons in an ApplicationControlBar.
                        >
                        > They are sliding, all the controls are displaying correctly, config
                        > changes
                        > are being picked up by main app OK etc. etc.
                        >
                        > Just simply wanted to know if it was possible to make a TitleWindow
                        > displayed
                        > in this way modal.
                        >
                        > I am trying to avoid PopUpManager if at all possible due to problems
                        > getting
                        > some complex data types backwards and forwards between them and the main
                        > app.

                        I believe that you have to create an object before you pass it to the
                        PopUpManager to show. In which case you have a reference to it, so you
                        should be able to talk and listen to it.


                        • 9. Re: Hw to make a PopUpButton item modal
                          injpix Level 3
                          "...I thought saying that I'm using a PopUpButton to display a component would have been clear..."

                          It should be clear. However, I am having a hard time visualizing a TitleWindow with a modal sliding out of a PopUpButton. After all, its a Pop*Up*Button.

                          Cheers
                          • 10. Re: Hw to make a PopUpButton item modal
                            IanCWatkins Level 1
                            The example I've based my work on is here:

                            http://blog.flexexamples.com/2008/04/13/creating-a-pop-up-titlewindow-using-the-popupbutto n-control-in-flex/

                            You click the PopUpButton and the TitleWindow slides down to display. I hope this clears up the confusion. :-)

                            Cheers

                            Ian
                            • 11. Re: Hw to make a PopUpButton item modal
                              injpix Level 3
                              Yes, that does. Thanks.

                              As I mentioned above, you can add something such as a Sprite that will have an index less then the TitleWindow. And you can have it appear to look like Flex's default modal (which has a blurr filter applied to it). But it must "block" mouse focus to any child below.

                              If your TitleWindow is a MXML Flex component, you can add the following between your mx:Script tags:

                              titleWindowInstance.rawChildren.addChildAt(modalSprite, 0);

                              And 'modalSprite' is an instance of a subclass of Sprite, which has the following in it:

                              public function ModalSprite()
                              {
                              //mouseDownHandler is a do-nothing handler.
                              var sprite:Sprite = new Sprite();
                              sprite.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);

                              //uses sprite.graphics to create the actual graphic
                              draw(sprite);
                              blur(sprite);

                              //add 'sprite' to DisplayObjectContainer
                              addChild(sprite);
                              }
                              1 person found this helpful