I'm using dynamic text on a flex sdk 4.1 RichEditable text control. I pass the control some html via the TextConverter class like this
<s:RichEditableText
id="partnerShipCopyRichText" width="600" height="250" clipAndEnableScrolling="true" verticalAlign="top" styleName="contentCopy" editable="false" selectable="true"
textFlow="{TextConverter.importToFlow(partnerShipCopy, TextConverter.TEXT_FIELD_HTML_FORMAT)}">
</s:RichEditableText>
The "copy" includes some anchor tags ( hrefs) and when rendered by default the anchor tags are blue. I tried various solutions that appeared to work pre flex sdk 4.1 but stopped rendering the entire copy block. The solution I found was to use the TextLayoutFormatValueHolder class instead of the TextLayoutFormat class. I beleive using the TextLayoutFormat causes an internal type co-ercion except that is caught by the framework but not returned to the caller so the rendering fails without a visible exception.
To provide "global" anchor tag formatting this code works for me :
import flashx.textLayout.elements.Configuration;
import flashx.textLayout.elements.TextFlow;
import flashx.textLayout.formats.TextDecoration;
import flashx.textLayout.formats.TextLayoutFormat;
import flashx.textLayout.formats.TextLayoutFormatValueHolder;
var config:Configuration = TextFlow.defaultConfiguration;
var normalTLF:TextLayoutFormatValueHolder = new TextLayoutFormatValueHolder(config.defaultLinkNormalFormat);
normalTLF.color = 0xFF00FF;
var hoverTLF:TextLayoutFormatValueHolder = new TextLayoutFormatValueHolder(config.defaultLinkHoverFormat);
hoverTLF.color = 0xFF0000; hoverTLF.textDecoration = TextDecoration.NONE; var activeTLF:TextLayoutFormatValueHolder = new TextLayoutFormatValueHolder(config.defaultLinkActiveFormat);
activeTLF.color = 0x00FF00; config.defaultLinkNormalFormat = normalTLF; config.defaultLinkHoverFormat = hoverTLF;
config.defaultLinkActiveFormat = activeTLF;
TextFlow.defaultConfiguration = config;
I may end up creating an example when I get five minutes!