How about using something like this...

                 var formChildren:Array = myForm.getChildren();
                 for each(var currentVBox:VBox in formChildren)
                 {
                     var VBoxChildren:Array = currentVBox.getChildren();
                     for each(var currentItem:* in VBoxChildren)
                     {
                         if(currentItem is TextInput)
                         {
                             (currentItem as TextInput).text = "";
                         }
                     }
                 }

--- In [email protected], Laurence MacNeill <lmacne...@...>
wrote:
>
> I have a form that has several dynamically-created children.  I'm
> having trouble using getChildByName() to retrieve data from them.
>
> Specifically, I create several VBoxes, and in each of those VBoxes I
> create children (a label a textInput).  Obviously, the TextInput that
> I'm trying to get the data from is a child of the VBox, not the
> 'this', right?   So it should be something like
> 'this.VBox.textInput'  right?  So I'd getChildByName the VBox first,
> then use the result of that to getChildByName the TextInput that's
> the child of the VBox, right?
>
> Well, it's not working.  when I try to this.getChildByName() the
> VBox, I get null instead.
>
> Here's my code, in case I haven't confused you enough.  It fails with
> a 'cant access property of null object' or something like that.
>
> public function resetFormHandler(): void {
>          var tempVBox:VBox;
>          var tempTextInput:TextInput;
>          var tempComboBox:ComboBox;
>          var tempCheckBox:CheckBox;
>          for (var i:int = 0; i<demoList.length; i++) {
>                  tempVBox = this.getChildByName("vbox" +
> demoList[i].name) as VBox;
>                  tempTextInput = tempVBox.getChildByName("input" +
> demoList[i].name) as TextInput;
>                  tempTextInput.text = "";
>          }
> }
>
> I really don't see why this isn't working -- the VBox was added to
> the form with the this.addChild() method.  So this.getChildByName
> should work to get it back right?  I'm completely confused.  Unless
> getChildByName *doesn't* use the ID field of the VBox to find
> it...  In which case, I have no clue how I'm gonna find it again.
>
> HELP!  :-)
>
>
> Laurence MacNeill
> Mableton, Georgia, USA
>

Reply via email to