within my custom UIComponent when I want to addchildren, should I always be overriding and using the
protected function createChildren ?
I notice I can use addChild anywhere without overriding the protected createChildren function and it still works.
Should I not be doing this ?
It's a good habbit to follow Flex SDK visual components life-cycle, since AS has asynchrounous nature it's better to keep all
child creation and configuration activities inside overrided createChildren method, this will keep your class more organized and predictable,
once you are free to addChild anywhere in the code, you could easily get lost in the creation chain and component initialization logic becomes hard to trace for you once component grows up. My advice is to use central spot for creation activity, rather than random placed addChild calls.. this will save you time in future Good luck
It depends on what purpose you are trying to addChild().
If you are doing that initially while creating the component only then it's better to use createChildren() function, but id you are tring to add child for displayng some data, say like list components or so, then try to use updateDisplayList() method.
cause, as far as I know, createChildren() method gets called when the component it self is added to display list, that is only single time, and updateDisplayList() gets called whenever th component needs to get updated.
Hope, this should help u