No, not a bad practice if you need references to them.  There might be more 
efficient ways depending on how long it takes to search the array.  If you post 
a trimmed down example of what you were trying to do, maybe others on the list 
can point you in the right direction.

Alex Harui
Flex SDK Developer
Adobe Systems Inc.<http://www.adobe.com/>
Blog: http://blogs.adobe.com/aharui

From: [email protected] [mailto:[email protected]] On Behalf 
Of Laurence MacNeill
Sent: Friday, May 15, 2009 10:34 AM
To: [email protected]
Subject: RE: [flexcoders] Problems with getChildByName();





At 02:52 AM 5/15/2009, you wrote:

>getChildByName searches the parent for a match with a child's .name
>property. A child's id property is not always the name and is a
>document reference (the outermost tag in the MXML file) so a parent
>won't always have a child with the name of the child's id.
>
>
>
>Usually in a script block, because the scope is the document, you
>just reference the id like it is a variable or property. You don't
>need getChildByName
>
>
>
>Alex Harui
>
>Flex SDK Developer
>
><http://www.adobe.com/>Adobe Systems Inc.
>
>Blog: <http://blogs.adobe.com/aharui>http://blogs.adobe.com/aharui

Is it bad practice to store all the children you create in an
array? Because that's what I wound up doing -- stored them in an
array as I created them, so I can loop thru them that way instead of
using the getChildByName or any of the getChild methods, as I
couldn't get any of them to work properly.

Laurence MacNeill
Mableton, Georgia, USA

Reply via email to