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:[EMAIL PROTECTED] On
Behalf Of David Chang
Sent: Wednesday, February 14, 2007 5:13 PM
To: [email protected]
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:[email protected] <mailto:flexcoders%40yahoogroups.com>
] 
> *On Behalf Of *Ian Shafer
> *Sent:* Wednesday, February 14, 2007 4:31 PM
> *To:* [email protected] <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
>
> 



 

Reply via email to