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

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;
> >                }
> >        }
> > }
> >
> >
> > a
> >
> >
> > On Tue, Jan 27, 2009 at 2:26 PM, Mendelsohn, Michael <
> > michael.mendels...@fmglobal.com> wrote:
> >
> > > Hi list...
> > >
> > > What exactly is the AS3 equivalent of making a simple component,
> > > creating a component definition, and attachMovie with the {} holding
> the
> > > params?
> > >
> > > I can't get this to work:
> > >
> > > package {
> > >        import flash.display.MovieClip;
> > >        import flash.text.*;
> > >        public class MyButton extends MovieClip{
> > >                public var buttonLabel:String;
> > >                public function MyButton (buttonLabel:String){
> > >                        this.buttonLabel = buttonLabel;
> > >                        btnLabel.text = buttonLabel;
> > >                }
> > >        }
> > > }
> > >
> > > The component definition has one parameter:
> > > Var: buttonLabel, default value:"Go", type:list
> > >
> > > I'm trying to instance a movie clip that contains instances of this
> > > variable.  I get various compiler errors when that parent clip is on
> the
> > > stage.
> > > Argument Error 1063 (Argument Count Mismatch) expected 1, got 0, when
> > > instancing a movieclip that contains these components.  But in parent
> > > movie clip, I am setting the params on the stage.
> > >
> > > Thanks,
> > > - Michael M.
> > >
> > > _______________________________________________
> > > Flashcoders mailing list
> > > Flashcoders@chattyfig.figleaf.com
> > > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> > >
> > _______________________________________________
> > Flashcoders mailing list
> > Flashcoders@chattyfig.figleaf.com
> > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> >
>
>
>
> --
> --
> 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
>
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to