4 Replies Latest reply on Sep 9, 2010 1:50 AM by RUSH-ME

    popups

    gayathri_

      How do you pass a variable(say a String) from a module to a popup in another mxml?

       

      In the main mxml i have :

       

      public function createPopUp():void
                  {
                      PopUpManager.createPopUp(this, Mymodule, false);
                     
                  }

       

      In the module  named Mymodule i have a statement

       

      parentApplication.createPopUp();

       

      The mxml for popup begins like this

      <?xml version="1.0"?>
      <mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="PopUpManager.centerPopUp(this);" showCloseButton="true"
                      close="PopUpManager.removePopUp(this)" width="365" height="250" title="Result" >

       

      I want the string passed from the module to be displayed as a message on the pop up.

        • 1. Re: popups
          RUSH-ME Level 3

          Hi

           

          You can create a public variable in parent application and assign  value from module by calling parentapplication.var_name = value;

          PopupManager.createPopup returns an object of your popup.

           

          var myPopup:MyModule = PopUpManager.createPopUp(this, Mymodule, false); //MyModule should be the class name of the popup

          myPopup.var_name = parentapplication.var_name;

           

          Hope this helps.

          Rush-me

          1 person found this helpful
          • 2. Re: popups
            gayathri_ Level 1

            Hi,

            I tried that but i am getting the following error


            1118: Implicit coercion of a value with static type mx.core:IFlexDisplayObject to a possibly unrelated type DisplayResult.    LearningProject.mxml    /LearningProject_Aparna_1/src    line 40    Flex Problem

             

             

             

             

            public function createPopUp(test:String):void
                        {
                            //dr.loading(test);
                            var myPopup:DisplayResult=PopUpManager.createPopUp(this, DisplayResult, false);
                            myPopup.text = test;
                           
                        }

            • 3. Re: popups
              flex4 Level 2

              Hi Gayathri.

               

               

                       If my understanding is correct.. u want to access popup mxml file from module right .. if it is correct if u dont mind please post ur popup mxml code

               

                           there are different ways to access popup method in another mxml file .... thanks...

              • 4. Re: popups
                RUSH-ME Level 3

                Hi

                Type cast it...

                var myPopup:DisplayResult = DisplayResult(PopUpManager.createPopUp(this, DisplayResult, false));

                 

                Hope this helps

                Rush-me