Your function Content is a public setter, so it's a property.Is this your goal? Or is it a mistake and just a function, in which case the name would be setContent??
Probably this property is set for the first time before the layout proces has finished. You'd better use dataBinding to avoid this. I'll give a simple example you can use as a starting point.
public var myLabel:String
public function setContent(newValue:String):void
if(newValue != null)
myLabel = newValue;
OK. One more thing. Within the same setter I'm trying to access child objects of the 'mainPanel' using something like:
(where lblData is a label inside mainPanel)
This gives me null in mainPanel as well. Where am I missing now???
Ok, so you use Content as a setter.
The question is WHEN this property is set for the first time. Ik you could 'postpone' this until the layout is created, then you should be able to acces mainPanel which will have been initialized already. You can do this by using the creationComplete event on your application.
Just to be sure: your panel is not inside a viewstack or tabNavigator or so?
Yup. Just checked for the component life cycle issue and ended up delaying the set property. Thanx!!!