Passing in Configuration object causes importToFlow to return null
Hi! I'm trying to style hyperlinks (href's) in a TextFlow using a Configuration class. I basically copied the example from here: http://help.adobe.com/en_US/flex/using/WS02f7d8d4857b1677-165a04e1126951a2d98-7fef.html. But the returned TextFlow is coming back null.
Here is a snippet of my code:
var textFlow:TextFlow = null;
/*** Configuration ***/
var cfg:Configuration = new Configuration();
var normalFmt:TextLayoutFormat = new TextLayoutFormat(cfg.defaultLinkNormalFormat);
normalFmt.color = 0xFF0000; // red
normalFmt.textDecoration = TextDecoration.NONE;
var hoverFmt:TextLayoutFormat = new TextLayoutFormat(cfg.defaultLinkHoverFormat);
hoverFmt.color = 0xFF00FF; // purple
hoverFmt.textDecoration = TextDecoration.UNDERLINE;
cfg.defaultLinkNormalFormat = normalFmt;
cfg.defaultLinkHoverFormat = hoverFmt;
/*********************/
if ( content.indexOf("TextFlow") != -1 )
{
textFlow = TextConverter.importToFlow(content,TextConverter.TEXT_LAYOUT_FORMAT, cfg);
}
else
{
textFlow = TextConverter.importToFlow(content,TextConverter.TEXT_FIELD_HTML_FORMAT, cfg);
}
If I remove the 'cfg' from the "importToFlow" method call, I get the default link colors (blue). Also, even if I go through the "TextConverter.TEXT_FIELD_HTML_FORMAT" with a 'cfg' object passed in, I get null returned.
Is using the Configuration object the best way to style the links? What is the preferred method?
Thanks!
