I've spent the last 36 hours almost straight trying to figure
this out so I hope someone has an answer...
I have built a composite component called dataManager. This
component is to be generic enought to re-use. It is comprised of an
ApplicationControlBar, DataGrid and Tabbed pannel. In the app file
this component is in a ViewStack. I would like to dynamcially
control the children inside the application control bar (label,
buttons, etc) as well as data that populates the grid and tabbed
panel based on what menu option the user has clicked on. The menu
component lives in the main app file.
I've set up properies in the dataManager component so that I
can pass in the appropriate data to be used by the component to
customize itself on the fly based on the data passed in. But just
doing something like setting the text of the application control
bar child component ( a label) like so: dataManager.acbLabel.text =
"asdfs" where acbLabel is the id of the label control, causes the
1009 error: Cannot access a property or method of a null object
reference. It doesn't matter whether I put that code in the main
app file or the component, I get the same error.
So bascially it comes down to needing to be able to
manipulate the components and children thereof in a composite
component at run time. I've written public funtions inside the
composite compenent and have no problem accessing them from the
main app file but as soon as I try to reference any of the mx:
elements within the component, I get the 1009 error.
Any help would be greatly appreciated. Maybe I'm going about
it all wrong.
It's hard to visualize exactly what's happening without some
sample code. However, you did mention a ViewStack. Perhaps it
hasn't yet created your component. Try setting the ViewStack's
creationPolicy="all". Otherwise, I'll need to see some code.