Hi, No, the initialize property is set in LayoutManager.
When the updateComplete queue runs, if the object is not initialized AND the instance has processed it's descriptors, the initialized flag is set to true. Then in the setter of initialized, the creationComplete event is dispatched. See childAdded(child) This happens ONLY once, unless for some wild reason you choose to switch the initialized flag back to false. createChildren() is called in initialize() > but does that mean if my component is added as a child of a basic UIComponent LayoutManager wont be called What do you mean, you are making your own layout manager? Of course this means that your initialized flag will never be set, this is a framework dependent on itself. It also means that you will never get a creationComplete even also. Dude, you are thinking way to much about this... If you want a method to override, override childAdded() who cares if it's mx_internal, it's not going anywhere. If not, just listen for the add event! $addChild() will dispatch it, so you will get that event right after the child has been added to the display list and before the childAdded() method. If you look at the addedHandler, that is a prime example of an event handler that should remain private. Peace, Mike On 8/3/07, reflexactions <[EMAIL PROTECTED]> wrote: > > 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 [email protected] <flexcomponents%40yahoogroups.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 [email protected] <flexcomponents%40yahoogroups.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 [email protected]<flexcomponents%40yahoogroups.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 > > > > > > > > > > > > -- Teoti Graphix http://www.teotigraphix.com Blog - Flex2Components http://www.flex2components.com You can find more by solving the problem then by 'asking the question'.
