4 Replies Latest reply on Jun 14, 2010 2:04 AM by Rdsingh Ldh

    issue in getting data from popup?

    flex_kkm Level 1

      i hav created a popup window called simpleWindow, and a custom event to retrieve data from the popup called "popupMessage" in follwing way.




      In popup i call the dispatchEvent in following way


      var outgoingEvent:Event = new Event("popupMessage",false);



      but the event is not called?. what may be the issue?...

        • 1. Re: issue in getting data from popup?
          SpaghettiCoder Level 3

          Have you declared?



          [Event(name="popupMessage", type="flash.events.Event")]



          You said you have a custom event, but from the code you posted it looks like you're just dispatching a regular Event.

          • 2. Re: issue in getting data from popup?
            flex_kkm Level 1

            you mean <mx:Metadata>. where i hav to decalre it?..

            • 3. Re: issue in getting data from popup?
              SpaghettiCoder Level 3

              Flex 4 is fx


              If you say mx, then you must be using 3.x


              you declare it in your whatever you are popping up...so if you created a custom component the declaration would go in that component.

              • 4. Re: issue in getting data from popup?
                Rdsingh Ldh Level 1



                To retrieve the data from the popup, you first need to create a custom class which wil be
                used to handle the events.

                I created the class as CustomEvents.as and then pass the data to the constructor of the
                class and the class look like as:

                import flash.events.Event;

                public class CustomEvents extends Event
                  public static const POPUPDATA:String = "popupMessage";
                  public var data:*;
                  public function CustomEvents(type:String,data:*)
                   this.data = data;


                once this is done then suppose on close of a popup you want to send data then this would be
                done by creating object of this customEvents.as Class and passing the data u want to send.
                in this u can dispatch event like this:


                outgoingEvent = new CustomEvents(CustomEvents.POPUPDATA,textInput.text);


                Above code is in the popup class and the corresponding event listener for that is in the
                main class and which is like:




                Hopefully this will solve your problem and if nowt do let me know. and

                if you are able to solve the problem mark it as such