I suggest looking at a custom component here, CustomInputBox or similar name. Have this component handle exposing the child TextInput.value. Then no 'reaching into children' from the parent is needed.
Douglas Knudsen http://www.cubicleman.com this is my signature, like it? On Fri, May 15, 2009 at 8:28 AM, Scott Talsma <[email protected]>wrote: > Try taking out your implict cast (e.g. as VBox), and set a breakpoint > on those lines. It could be that getChildByName is working, but the > casting fails. When you cast implicitly (using "as") you run the > risks getting null back. > > And while you have the breakpoint set, you may want to look at the > parent's children, so see if there are any there named the way you are > expecting them. > > On Thu, May 14, 2009 at 10:40 PM, Laurence MacNeill > <[email protected]> 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 and either a textInput, ComboBox or CheckBox). > 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++) { > > if (demoList[i].type == "TextInput") { > > tempVBox = this.getChildByName("vbox" + > > demoList[i].name) as VBox; > > tempTextInput = tempVBox.getChildByName("input" + > > demoList[i].name) as TextInput; > > tempTextInput.text = ""; > > } > > } > > } > > > > > > > > > > Laurence MacNeill > > Mableton, Georgia, USA > > > > > > > > ------------------------------------------------------------- > > To unsubscribe from this list, simply email the list with unsubscribe in > the > > subject line > > > > For more info, see http://www.affug.com > > Archive @ http://www.mail-archive.com/discussion%40affug.com/ > > List hosted by http://www.fusionlink.com > > ------------------------------------------------------------- > > > > > > > > > > -- > Scott Talsma > CTO, echoEleven > > > ------------------------------------------------------------- > To unsubscribe from this list, simply email the list with unsubscribe in > the subject line > > For more info, see http://www.affug.com > Archive @ http://www.mail-archive.com/discussion%40affug.com/ > List hosted by http://www.fusionlink.com > ------------------------------------------------------------- > > >
