2 Replies Latest reply on May 8, 2011 9:23 PM by Kristin95762

    sharing data with a TitleWindow

    Kristin95762 Level 1

      Hi

       

      I have a custom component popup TitleWindow with an accompanying class file. I'm having trouble sharing certain data between the main app and the popup. I've been successful to a certain point but I'm stuck on this one point: I am trying to access data based on a list.selectedItem.data selection.

       

      In the main app I load a list box. When I doubleclick on the item in the list box, a popup appears. When the popup opens I intend to use another sqlStatement to populate the popup.listbox with data based on a variable from the main app list.selectedItem.data.

       

      My problem is how to transfer the main app  list.selectedItem.data, load it into a variable that is used by the popup in a new sqlStatement and run a new query for use by the popup. I keep getting null errors.

       

      I've tried loading the listbox.selectedItem.data into a text input in the popup, but that doesn't work because, I assume, it isn't available to the sqlStatement yet. And I can't seem to get it to work by defining a String variable at the creationComplete event of the popup window.

       

      Thanks for your help

       

      Kristin

        • 1. Re: sharing data with a TitleWindow
          snkd Level 1

          I am sorry I can't understand your problem totally(specially sqlStatement).Sometimes this will help you.

          what i understand is you need to bind the selectedItem.property--in to component public bindable variable.

           

          Main App code

           

                          <snk:DriverDetails
                              id="cmpDriverDetails"
                              acCustomerDrivers="{crFclientdriverSRVListAll.lastResult}"
                              acMalkeyDrivers="{crDriverListAllResult.lastResult}"
                              acClientListAll="{crfdebtorSRVListAll.lastResult}"
                              com_dspl_malkey_domain_Freservation="{com_dspl_malkey_domain_Freservation}"
                              creationComplete="cmpDriverDetails_creationCompleteHandler(event)"
                              width="100%"
                              height="100%"
                              />

           

          DriverDetails component code

           

                      [Bindable]
                      public var acCustomerDrivers:ArrayCollection=new ArrayCollection();//pass data main app to component
                      [Bindable]
                      public var acMalkeyDrivers:ArrayCollection=new ArrayCollection();
                      [Bindable]
                      public var acClientListAll:ArrayCollection = new ArrayCollection();
                      [Bindable]
                      public var selectedItem:*=new Object();//pass data component to main app

           

          If you like the dispatch events this article wil help you..

          http://codexamples.blogspot.com/2010/10/how-to-create-flex-component-and-best_30.html

          • 2. Re: sharing data with a TitleWindow
            Kristin95762 Level 1

            Hey snkd:

             

            Thanks loads for your input.

             

            And thanks for the link. I will have a look at that tomorrow.

             

            I'm creating an AIR sqlite db app, thus the sqlStatement. I'm using results from a listbox selection in the main app in order to run a second query to populate another listbox in the popup window.

             

            Regards, Kristin