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