----- Original Message ----- From: "Mendelsohn, Michael" <michael.mendels...@fmglobal.com>
To: "Flash Coders List" <flashcoders@chattyfig.figleaf.com>
Sent: Wednesday, February 18, 2009 5: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.

That's a polarised view that isn't strictly true. If you're dragging components to the stage in the IDE, how is the IDE supposed to instantiate the component with the appropriate parameters?

You can always achieve a similar effect by having a parameterless constructor coupled with a parameterised init() method. Nothing stopping you having the same architecture for stage components and actionscript created class instances. In many ways, the parameterised init() is preferable to a parameterised constructor.

Paul

Any feedback is appreciated.
- Michael M.

_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to