views:

811

answers:

1

I'm trying to figure out the most elegant way to change the color of just one character of the label on a LinkButton control. Given something like this:

<mx:Style>

    myLinkButtonStyle
    {
     textRollOverColor: #FFFFFF;
    }

</mx:Style>

<mx:LinkButton label="My Label" styleName="myLinkButtonStyle" />

... what'd be the most appropriate, most "Flex-appropriate" (if you will) way to change, for example, the word "Label" from white to red on rollover only? Seems like this ought to be relatively simple, and I'm sure there's probably a TextRange in there somewhere, but I figured I'd ask the question here first before heading down a blind (or badly hacked) alley. Thanks in advance!

+1  A: 

I really don't think that is built in. My guess is that you will need to subclass LinkButton, overwrite commitProperties and updateDisplayList and have an extra property on the subclass that lets you define the word or range that needs to be highlighted.

Christophe Herreman