When the link is selected, you can get the link information by using the selection. The selected range is provided by the interactionManager, and you take the range and use it to find the link. To get the info on the first link in the selection, you could do something like this:
var pos:int = textFlow.interactionManager.absoluteStart;
var endPos:int = textFlow.interactionManager.absoluteEnd;
var leaf:FlowLeafElement = textFlow.findLeafAtPosition(pos);
while (pos < endPos)
{
var link:LinkElement = leaf.getParentByType(LinkElement);
if (link != null) // Found it!
{
return link.href;
}
pos = pos + leaf.textLength;
leaf = leaf.getNextLeaf();
}
I haven't compiled this code or tested it, but something like this should get you what you need.
For your second question, about controlling the highlighting, you should define your own SelectionFormat. The SelectionFormat defines how the selection draws in each of three selection states: focused (when the TextFlow has keyFocus), unfocused (something else has keyFocus) and inactive (window is not active). TLF supplies your application with default SelectionFormats, which you can override by setting your own values, e.g.:
textFlow.interactionManager.unfocusedSelectionFormat = new SelectionFormat(...);
Hope this helps,
- robin