Michael, Haven't you read my reply to one of your prev. questions? Well, let me quote it here again: === Subject: Re: [Flashcoders] my component not instancing properly on timeline
It seems your problem is similar to one I had with my components. The matter is that, unlike their behavior in AS2, in AS3 (CS3) components setters of [Inspectable] parameters are called lo-o-ong AFTER constructor As described here http://www.bit-101.com/blog/?p=1181 So, even if I set my init() as listener for ADDED_TO_STAGE event... it's still before setters. for now, I found a solution: I put my init() in ENTER_FRAME listener and then remove this listener :-) This means that listeners are called before 1st ENTER_FRAME event. Perhaps my solution isn't too elegant.... but it works :-) Also, be sure to duplicate default values for your parameters :-) === Note that the above solution is intended to use with sprite-based components. Perhaps if you subclass UIComponent, the situation with setters is better... perhaps :-) On 2/18/09, Muzak <p.ginnebe...@telenet.be> wrote: >> You can either make a component designed for the >> stage OR for instancing through code? > > Not really, that's not what it says. > Just says that you can't (and IMO should never have to) pass arguments to > the constructor when dropped on stage. > > If you want "talk" to your component both through AS and when on stage, use > [Inspectable] getter/setters > > class MyComp { > > [Inspectable] > public function get symbolName():String { > return _symbolName > } > public function set symbolName(value:String):void { > _symbolName = value; > // do stuff with value > } > } > > regards, > Muzak > > ----- Original Message ----- > From: "Mendelsohn, Michael" <michael.mendels...@fmglobal.com> > To: "Flash Coders List" <flashcoders@chattyfig.figleaf.com> > Sent: Wednesday, February 18, 2009 6:55 PM > Subject: RE: [Flashcoders] component def doesn't pass params to constructor? > > >> Hi list... >> >> Researching my own pesky issue (custom components initializing properly >> when they're dragged on the stage at author time), I found this: >> >>> if you want to create instances of your classes by dragging them to >> the stage, keep in mind that their constuctors can not accept arguments. >> Also, keep in mind that >> Its a really good idea to pick unique names for your custom classes. >> It's widely agreed class-names should start with the capital letter >> >> Source: http://www.actionscript.org/forums/showthread.php3?t=159332 >> >> So, is this true?? You can either make a component designed for the >> stage OR for instancing through code? That seems wrong in AS3. >> >> Any feedback is appreciated. >> - Michael M. >> > > _______________________________________________ > 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