> could you put your init() method call in a setter?

No :-)
Actually, these [Inspectable] parameters and their setters are not a
*functional* part of component. I mean that, if it's created via code
(using constructor), [Inspectable] parameters are not used.
However, if user has the component in Flash IDE and set anything in
component properties/inspector, they should work.

for now, I found a solution:
I put my init() in ENTER_FRAME listener and then remove this listener :-)
I just wanted to be sure that there's no solution more elegant than mine....




>  On Wed, Jan 28, 2009 at 10:27 AM, Gregory N <greg.gousa...@gmail.com> wrote:
>
>  > Yes, as allandt  suggests, you should provide a default value for
>  > constructor param
>  > Unfortunately, it's not the only problem with components (at least in CS3)
>  > For me, the worst one is about [Inspectable] parameters (and their
>  > setters).
>  > As described here
>  > http://www.bit-101.com/blog/?p=1181
>  > setters are called lo-o-ong AFTER constructor
>  > And, even if I set my init() as listener for ADDED_TO_STAGE event...
>  > setters
>  > are not called before it :-(
>  >
>  > Any advice to determine the exact time setters are called?
>  >
>  >
>  > On 1/27/09, allandt bik-elliott (thefieldcomic.com) <alla...@gmail.com>
>  > wrote:
>  > >
>  > > you can put the default value into the parameters in the constructor so:
>  > >
>  > >
>  > > package {
>  > >        import flash.display.MovieClip;
>  > >        import flash.text.*;
>  > >        public class MyButton extends MovieClip{
>  > >                public var buttonLabel:String;
>  > >
>  > >                public function MyButton (buttonLabel:String = "GO"){
>  > >
>  > >                        this.buttonLabel = buttonLabel;
>  > >                        btnLabel.text = buttonLabel;
>  > >                }
>  > >        }
>  > > }
>  > >



-- 
-- 
Best regards,
 GregoryN
================================
http://GOusable.com
Flash components development.
Usability services.
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to