Skip to main content
Participant
November 22, 2011
Question

How to dynamically add a hyperlink in a RichEditableText?

  • November 22, 2011
  • 1 reply
  • 884 views

Hi

This may be at bit embarrassing, but how can I add a link by using a button in a RichEditableText? I've been searching for hours without success.

I'm working in a texteditor and all I want is to be able to mark a text, then hit a button "set link" where a link is added to the marked text in the RichEditableText-field. It was so easy with textformat.url and textformat.target in a classic textfield... 😞

Thanks!

This topic has been closed for replies.

1 reply

Adobe Employee
November 23, 2011

Get the child element of RichEditableText, which should be an instance of flashx.textLayout.elements.TextFlow.

Then there are two ways to add a link dynamically,

1) EditManager.applyLink()

2) add LinkElement as one child of a ParagraphElement. (ParagraphElement is one kind of child of TextFlow. There can be many paragraphs in a textflow)

For tags, they are <s:TextFlow> <s:p> <s:a>

Participant
November 23, 2011

Perfect! :-) Thank you very much!