Use custom AS Class in MXML
hi,
i have custom class extend button, , parameters needed in constructor.
when try put class in mxml visual compoents such <mx:custombutton />
argumenterror: error #1063: argument count mismatch on ____ expected 0, got 1.
appearently parameters constructor missed. how can pass parameters in tag?
thanks in advances.
c.
i have custom class extend button, , parameters needed in constructor.
when try put class in mxml visual compoents such <mx:custombutton />
argumenterror: error #1063: argument count mismatch on ____ expected 0, got 1.
appearently parameters constructor missed. how can pass parameters in tag?
thanks in advances.
c.
you can't use arguments on constructor in mxml. aside of else, there's no way pass them. options - if want use same component , want constructor arguments, make them optional:
public custombutton(myarg:string=null)...
the attributes specified in mxml assigned public properties same name once instance has been created. if want able say:
<mx:custombutton myarg="hello"/>
you'll need like:
public class custombutton extends button{
public var myarg:string;
}
by way it's conventional use uppercase start name of class, , lowercase start name of instance. conventional call class custombutton.
tim
public custombutton(myarg:string=null)...
the attributes specified in mxml assigned public properties same name once instance has been created. if want able say:
<mx:custombutton myarg="hello"/>
you'll need like:
public class custombutton extends button{
public var myarg:string;
}
by way it's conventional use uppercase start name of class, , lowercase start name of instance. conventional call class custombutton.
tim
More discussions in Flex (Read Only)
adobe
Comments
Post a Comment