[flexcoders] getChildByName using it to get the value of a textbox
when using getchildbyname variable i've not been able to get the value can someone please post an example of how to get a value using getChildByName. var test:DisplayObject = this.getChildByName(inputtext + i);
Re: [flexcoders] getChildByName using it to get the value of a textbox
You need to cast it to the type of object you want to operate on: var test:TextBox = this.getChildByName(inputtext + 1) as TextBox; or var test:TextBox = TextBox(this.getChildByName(inputtext + 1)); The first form will return null if it cannot cast the displayObject to that type as opposed to the second which will cause an error. Of course the Eclipse help system is so utterly useless that searching for 'as' will return nothing and displayObject will not be in the first 3 items you search for. Regards, Nik
RE: [flexcoders] getChildByName using it to get the value of a textbox
Why are you trying to use getChildByName to get a reference to a component? If you give it an 'id' attribute in MXML, you can then refer to it by that id. Gordon Smith Adobe Flex SDK Team From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Jason B Sent: Monday, August 18, 2008 8:07 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] getChildByName using it to get the value of a textbox when using getchildbyname variable i've not been able to get the value can someone please post an example of how to get a value using getChildByName. var test:DisplayObject = this.getChildByName(inputtext + i);