<mx:Label text="Crazy about Flex"/>
You are not logged in.
Pages: 1
Doable, although not as trivial. You can do this by setting a stylesheet containing the pseudo class you usually use in regular CSS to customize a hyperlink. And when I say stylesheet, I mean flash.text.Stylesheet that will affect the HTML DOM, NOT Flex Styles which affects Flex DOM. Here's a sample:
import mx.core.mx_internal;
public function textHandler(e:Event):void
{
var styleSheet:StyleSheet = new StyleSheet();
styleSheet.setStyle("a:link", { textDecoration: "none", color: "#813F98" });
styleSheet.setStyle("a:hover", { textDecoration: "underline" });
styleSheet.setStyle("a:active", { textDecoration: "underline" });
e.currentTarget.mx_internal::styleSheet = styleSheet;
}
<mx:Text initialize="this.textHandler(event)">
<mx:htmlText>
<![CDATA[
<a href="#">Click!</a>
]]>
</mx:htmlText>
</mx:Text>A word of caution: Adobe uses the mx_internal namespace to mark things that may change in future versions of the framework. So use this at your own risk, your code may not work with future releases of Flex.
Another less elegant alternative is to add rollover and rollout listeners to the label/text, parse its htmlText and add <u></u> to it.
Why is it so ridiculously hard to do something so simple? Here's a comment from Gordon Smith, a Flex developer at Adobe.
Gordon Smith wrote:
We haven't devoted a lot of attention to HTML text in Flex because the Flash Player's support for HTML is so limited and many Flex developers find it doesn't meet their needs, Apollo will change that, but it isn't clear when the Player's HTML support for Flex apps in the browser will get better.
Offline
Very cool, could not find that anywhere!
Thanx, will try next time.
Offline
Pages: 1