Well I think the answer is that statement is not completely accurate.

createChildren stems from the call to initialize, however initialize 
is not called everytime a component is added, it may only be called 
once.

So in theory if a component was added, removed and then added again 
createChildren may only be called on the first and not the 
second "add".

However I am not sure if this is always true, it hinges on when the 
initialized flag gets set, once it is set then initialize and 
therefore createChildren will never get called again. 

It appears that the flag is set by the LayoutManager somehow, though 
I havent quite figured out when or if it actually does it i.e. does 
it only happen when a component is added to a Container or does it 
also happen when a component is added to any UIComponent etc.

For the moment I have added an "added" handler which is doing what I 
need.

tks
 

--- In flexcomponents@yahoogroups.com, "Michael Labriola" 
<[EMAIL PROTECTED]> wrote:
>
> 
> I may be missing the point, and if I am am, then sorry in advance.
> 
> createChildren should only be called once it is actually added to a 
> displayList. So couldn't you just override this method in your 
child 
> and set a 'flag' or do whatever you need.
> 
> --- In flexcomponents@yahoogroups.com, "reflexactions" 
> <reflexactions@> wrote:
> >
> > There is an "add" event but I think this only gets fired if your 
> are 
> > attaching to a Container not a UIComponent.
> > 
> > 
> > There is an "added" event however the addedHandler is declared 
> > private in UIComponent so cant be overridden.
> > 
> > I guess I could duplicate what UIComponent does and add 
> > another "added" event Handler (called something else instead of 
> > course, though it  bugs me a component needs to create multiple 
> event 
> > handler for the same event, see earlier post). This fires before 
> the 
> > component is initialized so I think the logic would be in the 
> handler 
> > to check the "initialized" flah and if false do nothing and pick 
> > everything up in the initialization complete function, if true 
> > execute the code here.
> > 
> > 
> > Thanks 
> > 
> > 
> > --- In flexcomponents@yahoogroups.com, "reflexactions" 
> > <reflexactions@> wrote:
> > >
> > > Just wondering what sure fired way there is for a component to 
> know 
> > its 
> > > been added as the child of something (a UIComponent, a 
> > > DisplayContainer)?
> > > 
> > > parentChanged - called BEFORE the component is added, no good
> > > 
> > > stylesInitialized - called BEFORE and also I think potentially 
> > before 
> > > the components createChildren, so no good
> > > 
> > > initialize - called AFTER being added, ok thats good 
> > but..initilaize is 
> > > only called if the component hasnt been intialized already. So 
> its 
> > not 
> > > garaunteed to always be called.. ( However I am having a hard 
> time 
> > > finding where "initialized" gets set, from what I can see it 
set 
> by 
> > the 
> > > LayoutManager, but does that mean if my component is added as a 
> > child 
> > > of a basic UIComponent LayoutManager wont be called and 
> > > therefore "initialized" would never get set to true so the 
> function 
> > > initilized will always get called...??????)
> > > 
> > > Thanks
> > >
> >
>


Reply via email to