4 Replies Latest reply on Jul 19, 2007 10:17 AM by dimival

    PopUp data transfer

    teliche
      I've created a pop up wherein the user can enter information, how do I get that info back to where I called it from? I know I can set certain values in the pop up when it's created
      (i.e.)
      private function make_popup():void{
      var my_pop_up:Info_pop_up(this, Info_pop_up, true) as Info_pop_up;
      my_pop_up.txt1.text = "strawberries";
      }

      but now if the user changes the "txt1" text field to 'blueberries', how do I get that info back from the pop up?
        • 1. Re: PopUp data transfer
          dimival Level 1
          You can dispatch a custom event with all the info that you want, and have the parent application listen to it and obtain the info contained in the event.
          • 2. Re: PopUp data transfer
            bdeen
            dimival has a great idea I've done that before.

            You can also make a proprety bindable on the pop-up and bind it to the property you have in the main application that it has, however this method will not depend upon clicking any buttons, once the bindable event occurs it'll be updated.

            But a custom event will give you something similar but with better control of firing the event.

            • 3. Re: PopUp data transfer
              teliche Level 1
              Great stuff, thanks very much! I was hoping that you would be able to just "pass back" some parameters or something, but, oh well. At least I'll get more experience with events =)
              • 4. Re: PopUp data transfer
                dimival Level 1
                I know that sometimes events can be a pain in the....... jaja but trust me, when your app becomes more and more complex you'll be thankful for the event model :P, using events for this is a lot cleaner :P

                Glad to help, mark this topic as closed by marking a post as the answer :)