I think I would override createComponentsFromDescriptors so you know when all 
of the children have been created.

From: [email protected] [mailto:[email protected]] On 
Behalf Of Sergey Kovalyov
Sent: Wednesday, December 24, 2008 8:12 AM
To: [email protected]; [email protected]
Subject: [flexcomponents] commitProperties() and navigation container children

Hi All!

Long time ago I have asked the question regarding commitProperties() 
implementation in the container that might be a navigation container child: 
http://www.mail-archive.com/[email protected]/msg47993.html

Unfortunately, I have not got any answer.

Though we, in our team, use kind of workaround:

 override protected function commitProperties() : void {
 super.commitProperties();

 if (processedDescriptors) {
  // Do all properties deferred processing here.
 } else {
  _commitPropertiesPostponed = true;
 }
}

...

private function onInitialize() : void {
 if (_commitPropertiesPostponed)  {
  _commitPropertiesPostponed = false;
  invalidateProperties();
 }
}
Thus if the commitProperties() is executing and there are no children created 
yet (this happens for navigation containers childrent and can be verified via 
processedDescriptors), we set the _commitPropertiesPostponed flag to true and 
then in initialize event handler reset it and call invalidateProperties() to 
execute commitProperties() once again.

Though it looks like a hack.

May be we are doing something wrong and better solution exists?

Sergey.

Reply via email to