5 Replies Latest reply on Dec 27, 2006 10:43 AM by ntsiii


      is there any way to create popups not from a different mxml file, but that the popup would be just a container in the main file ??

        • 1. Re: popup
          Level 1
          You could create the popup object dynamically in actionscript. However, if you wanted to use mxml, I believe it has to be a separate file.

          What's your reasoning for not wanting to use a separate file?

          • 2. Re: popup
            ntsiii Level 3
            If you can use a standard class then you can pop-it up directly. I believe. I'll try this now to be sure and post an example.

            • 3. Re: popup
              ntsiii Level 3
              Yep, you can. I'll paste an example using a Text control below. I am sure you could also pop-up a container, like a panel or HBox, and even dynamically populate it using addChild. That'll be a later example though.

              Andy's question is a good one though. Except for trivial uses, an external file is much more flexible. What is you issue with an external file?

              • 4. Re: popup
                ntsiii Level 3
                Oh, another possibility: If your application uses absolute layout, you can include some container with any content, and then set its visible property to false. To "pop it up", just make it visible. This is not really a pop-up, but looks exactly like one.

                Put it at the end of the mxml, so it will display on top, or look into the depth manager.

                • 5. Re: popup
                  ntsiii Level 3
                  The example:
                  <?xml version="1.0" encoding="utf-8"?>
                  <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="vertical" horizontalAlign="left">
                  import mx.managers.PopUpManager;
                  import mx.core.IFlexDisplayObject;
                  import mx.controls.Text;
                  private var _TextPopUp:Text;
                  private function showPopup():void
                  _TextPopUp = Text(PopUpManager.createPopUp(this, Text, false));
                  _TextPopUp.x = 100;
                  _TextPopUp.y = 100;
                  _TextPopUp.text = "Test text in pop-up"

                  private function closePopup():void

                  <mx:Button click="showPopup()" label="Pop Up Text box" />
                  <mx:Button click="closePopup()" label="Close Pop Up" />