2 Replies Latest reply on May 11, 2011 7:22 AM by miguel8312

    sharing variables between components

    Kristin95762

      Hi

       

      I have a main app, a custom component, and a class file.

       

      In the main app I have this code:

       

       

      private function authorGrid_doubleClickHandler(event:MouseEvent):void

      {

      popup = new BookDetailsWindow();

      popup.addEventListener(Event.CLOSE, closeBookDetailsHandler);

      popup.addEventListener("readBooksDetail", readBookDetailsHandler);

      popup.addEventListener("cancel", closeBookDetailsHandler);

      PopUpManager.addPopUp(popup, this, true);

      popup.title = (authorGrid.selectedItem as Object).title;

      popup.bookTitleTxt.text = authorGrid.selectedItem.title;

      bdSelectedBook = authorGrid.selectedItem.title;

      trace(bdSelectedBook);

      PopUpManager.centerPopUp(popup);

       

      }

       

       

      Currently, I am passing a value to the popup via the popup.bookTitleTxt.text = authorGrid.selectedItem.title;

      I use the bookTitleTxt.text value in a parameter for a query in the actionscript file for the popup custom component.

      This works the way it should but what I would rather do is use something like

      bdSelectedBook = authorGrid.selectedItem.title; so I can pass this value to a SELECT statement in the custom component.

       

      How do I set up variable sharing? I have the same variable defined in all three files, declared as public, but it returns null.

       

      Thanks alot for your help.

       

      Kristin