That is correct. Code behinds for components cannot take constructor
arguments, there isn't a mechanism to pass them in.

You will want to pass them in and act on them at some other point in the
component lifecycle. Such as CreationComplete, or Initialize.

David Moore

Flash and Flex Developer - http://vandermore.com


On Tue, Oct 27, 2009 at 12:28 PM, Tim Romano <[email protected]> wrote:

>
>
> It seems a class whose constructor takes arguments cannot be used as the
> code-behind class. Is that so? When I try to use this class in the root tag
> of my mxml component, there's an error: no default constructor in the base
> class TestArgs.
> Thanks
>
> package
> {
>     import mx.containers.TitleWindow;
>     import mx.controls.LinkButton;
>     public class TestArgs extends TitleWindow
>     {
>
>         public var aLinkButton:LinkButton;
>         private var _arg1: String;
>
>         //public function TestArgs(){}
>
>         public function TestArgs(arg1:String)
>         {
>             super();
>             _arg1 = arg1;
>         }
>
>     }
> }
>  
>

Reply via email to