3 Replies Latest reply on Nov 4, 2008 8:46 PM by sandwicense

    How do I set the variable of a custom component

    sandwicense Level 1
      I have a custom component based on the TitleWindow component and I have declared a bindable public variable in that custom component's script tag. In my app If the user clicks a button, flash will open the title window using the PopUpManager. After it is opened, I want to pass in some data. I have tried doing this a number of different ways, but have failed. Can someone help me? Thank you in advance!
        • 1. Re: How do I set the variable of a custom component
          Gregory Lafrance Level 6
          import mx.core.Application;

          titleWindowClickHandler(event:MouseEvent):void{
          titleWindowVar = Application.application.mainAppVar;
          }
          • 2. Re: How do I set the variable of a custom component
            sandwicense Level 1
            Thank you for responding. I don't quite get the third line of your code. This is the function where I call the PopUp:

            public function editQuote():void {
            //Fill in fields of SingleRecordDetail component
            //currentStudent = quoteGrid.selectedItem;
            //Open the Quote_SingleRecord pop up
            var editQuoteWindow:TitleWindow = TitleWindow(PopUpManager.createPopUp(this, quoteSingleRecordDetail, true));
            PopUpManager.centerPopUp(editQuoteWindow);
            //Set the value of the bindable variable that will determine the title of the Quote_SingleRecordDetail panel
            var selectedStudentName:String = quoteGrid.selectedItem.lastname + ", " + quoteGrid.selectedItem.firstname;
            editQuoteWindow.title = "Editing Quote for: " + selectedStudentName;
            currentStudentAsProperty = quoteGrid.selectedItem;
            }
            • 3. Re: How do I set the variable of a custom component
              sandwicense Level 1
              I solved my problem. I changed the variable type to the name of my custom component. From the code I pasted above, this is the only edit:

              var editQuoteWindow:quoteSingleRecordDetail = quoteSingleRecordDetail(PopUpManager.createPopUp(this, quoteSingleRecordDetail, true));