2 Replies Latest reply on Dec 10, 2010 7:19 AM by Ben Danis

    Dynamic Set Style

    Ben Danis Level 1

      I am creating my own type of button with HTML text and a bunch of other visual assets that have to be added dynamically.


      on Rollover, i'm trying to do a

      txt.setStyle("color", 0xFCAF17) // value tried as string as well '#FCAF17'


      txt.setStyle("fontWeight", "bold")


      but it refuses to change the color or the weight, i've tried adding after

           txt.htmlText = txt.htmlText, but it doesn't change the color

      as well as updating display list.


      I've also tried

           var ct:ColorTransform = new ColorTransform();

           ct.color = 0x0xFACF17

           txt.transform.colorTransform = ct;

      but that also colors the drop shadow filter applied to it.


      also tried doing a bindable variable for the color but that doesn't work either



      I know that documentation says to avoid setStyle as it is computation heavy.  But i don't see any other way


      is there a way to do this without adding <font> tags to my html text?

        • 1. Re: Dynamic Set Style

          I am not sure if i understand that you are looking for but if you are trying to change the

          color of the text on rollOver you can use the "textRollOverColor".

          • 2. Re: Dynamic Set Style
            Ben Danis Level 1

            I'm trying to create a custom button with a text component for html text display.  On rollover trying to change the color of text (textRollOverColor doesn't work if text is html) and on click i want to make it bold


            If i set the property text instead of htmlText, it seems to work, although not ideal in this case