I don't understand. Once you use the "new" operator, the button is
instantiated. You can apply all sorts of styles to it before adding it
to the displayList. For example, this works for me...
var button:Button = new Button;
button.label = "My Fancy New Button";
button.setStyle("cornerRadius", 9);
button.setStyle("fontSize", 24);
button.setStyle("themeColor", '#00FF00');
button.setStyle("fillColors", ['#6699ff', '#6699ff',
'#6699ff', '#6699ff']);
button.setStyle("fillAlphas", [1, 1, 1, 1]);
this.addChild(button);
--- In [email protected], "hworke" <kanps...@...> wrote:
>
>
>
> Hi I am trying to apply style in a newly created component
> but since it is not instantiated it gives me error message.
>
> My code is like this:
>
> var button:Button = new Button;
> button.setStyle("styleName", "myStyle");
> canvas.addChild(button);
> I need to create the component dynamically and also need
> to apply the style dynamically. How can I do that?
>
> Regards,
>