The initialize() method of UIComponent calls initializationComplete(). UIComponent's implementation of initializationComplete() sets processedDescriptors to true, which causes the "initialize" event to be dispatched. However, Container overrides initializationComplete() to do nothing, because a container's initialization isn't considered to be complete until it's children's initialization is complete. If the children undergo deferred instantiation, the container's "initialize" event is deferred. - Gordon
________________________________ From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of ishafe Sent: Thursday, February 15, 2007 2:42 PM To: [email protected] Subject: [flexcoders] Re: Handling initialized event with AS3 custom component Interesting. I'd love to understand the distinction. --- In [email protected] <mailto:flexcoders%40yahoogroups.com> , "Gordon Smith" <[EMAIL PROTECTED]> wrote: > > Overriding the initialize() method is similar to, but not the same as, > handling the 'initialize" event. The two don't always happen at the same > time. > > - Gordon > > ________________________________ > > From: [email protected] <mailto:flexcoders%40yahoogroups.com> [mailto:[email protected] <mailto:flexcoders%40yahoogroups.com> ] On > Behalf Of David Chang > Sent: Wednesday, February 14, 2007 5:13 PM > To: [email protected] <mailto:flexcoders%40yahoogroups.com> > Subject: Re: [flexcoders] Handling initialized event with AS3 custom > component > > > > Also this should work too... > > package com.example.test { > > public class Test extends VBox { > public override function initialize():void { > super.initialize(); > // Do something > } > } > } > > Gordon Smith wrote: > > > > In AS3 code you use the addEventListener() method to register an event > > > handler to receive a particular kind of event from a particular > object: > > > > package com.example.test > > { > > public class Test extends VBox > > { > > // Constructor > > public function Test > > { > > super(); > > addEventListener(FlexEvent.INITIALIZE, myHandler); > > } > > > > // Handler for "initialize" event > > private function myHandler():void > > { > > // Do something > > } > > } > > } > > > > - Gordon > > > > ---------------------------------------------------------- > > *From:* [email protected] <mailto:flexcoders%40yahoogroups.com> > <mailto:flexcoders%40yahoogroups.com> > [mailto:[email protected] <mailto:flexcoders%40yahoogroups.com> <mailto:flexcoders%40yahoogroups.com> > ] > > *On Behalf Of *Ian Shafer > > *Sent:* Wednesday, February 14, 2007 4:31 PM > > *To:* [email protected] <mailto:flexcoders%40yahoogroups.com> <mailto:flexcoders%40yahoogroups.com> > > > *Subject:* [flexcoders] Handling initialized event with AS3 custom > > component > > > > Hello, > > > > How do I handle an "initialized" event using an AS3 custom component? > > > > In MXML it would be like this: > > > > <mx:VBox initialize="myHandler"> > > <mx:Script><![CDATA[ > > private function myHandler():void { > > // Do something > > } > > ]]></mx:Script> > > </mx:VBox> > > > > My guess is that I can do something like this: > > > > package com.example.test { > > public class Test extends VBox { > > private function initialize():void { > > // Do something > > } > > } > > } > > > > But I can't find any documentation. > > > > Thanks, > > > > Ian > > > > >

