views:

274

answers:

2

I am using Flex AS3, i have a accordian with two tabs each tab contains some text boxes and i am trying to access these child controls from button event handler which resides outside the accordian, Problem is these controls are null until i open the tabs of accordian.

+2  A: 

Add this to the MXML of your accordion

creationPolicy="all"

It will then create everything at the beginning so those children will be there for you to reference.

invertedSpear
Thanks for quick help, This works fine but raises some more issuesNormal controls i.e. TextBox are loaded fine, but repeater(child control of accordian) is not loading correctly. any suggestion.
Lalit
Haven't seen a problem with things like lists and datagrids, I tend to avoid repeaters. I would post another question and give a code example of your repeater. It may be as simple as setting the creation policy of the repeater to all as well.
invertedSpear
Oh, to be clear, I don't avoid repeaters for any particular reason, I just haven't come across a need for them yet. I think it's because my methods use loops in actionscript to create controls on the fly. I could probably benefit from repeaters if I learned more about them.
invertedSpear
A: 

You could try programatically opening and closing the accordion on something like creationComplete to force the creation of the components in the repeater. I would second avoiding repeaters. I have found with a little creativity you can do much better with basic lists and custom item renders. This gives you a lot more control over the creation of the child components.

Ryan K