6 Replies Latest reply on Aug 21, 2009 6:37 AM by ice1000

    How to Erase All ComboBox Children?

    ice1000

      In my application, when changing from the base state, all my combo boxes get populated with data.

       

      I would like to 'reset' the combo boxes when state returns to the base.

      I wrote a loop that cycles through all children of a hBox (btnContainer) when the state changes back to base.

       

      I can reset one combobox as follows: colChart.ccCombo.data = null. Works ok.

       

      When I loop through the children, I get a series of IDisplayObjects and I can't use the data property to set it to null.

       

      How can I set each ComboBox to null in the loop?

       

      private function doDispose():void {
        var ccTemp:ComboBox;

        for (var i:int = 0;i<colChart.btnContainer.numChildren;i++){
          if(colChart.btnContainer.getChildAt(i) is ComboBox) {
            //trace(colChart.btnContainer.getChildAt(i).name);

       

            //doesn't work

            //ccTemp = colChart.getChildAt(i) as ComboBox;
            //ccTemp.data = null;
            }
          }

      }