In that case he should use the styleName property...

         .myStyle
         {
            cornerRadius: 9;
            fillAlphas: 1, 1, 1, 1;
            fillColors: #6699ff, #6699ff, #6699ff, #6699ff;
            themeColor: #00ff00;
            fontSize: 24;
         }

                 var button:Button = new Button;
                 button.label = "My Fancy New Button";
                 button.styleName = "myStyle";
                 this.addChild(button);

--- In [email protected], Erik de Bruin <erikdebr...@...>
wrote:
>
> Hi,
>
> I think he's trying to set a named CSS style ("myStyle") on the Button
using
> setStyle(). I don't think that's possible?
>
> EdB
>
> On Fri, Jan 15, 2010 at 3:02 PM, valdhor [email protected]:
>
> >
> >
> > 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" kanpsack@ 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,
> > >
> >
> >
>
>
>
> --
> Ix Multimedia Software
>
> Jan Luykenstraat 27
> 3521 VB Utrecht
>
> T. 06-51952295
> I. www.ixsoftware.nl
>

Reply via email to