1

I want to programmatically insert formatted text at the current cursor position in a Flex 4 (Spark) RichEditableText control. I could just modify the .text property.... But that doesn't allow me to insert formatted text. So I believe I need to interact with either .textFlow or .textFlow.interactionManager somehow? However, TLF is quite complex and I can't find a simple way to do what I want.

2 Answers 2

1

This seems to do it. It's a lot of work though. Not sure how I feel about all the added complexity of the new text layout framework in Flash.

var txt:RichEditableText;
var html:String = "<b>some <i>rich</i> text</b>";

var mgr:EditManager = txt.textFlow.interactionManager as EditManager;
var flow:TextFlow = TextConverter.importToFlow(html, TextConverter.TEXT_FIELD_HTML_FORMAT);
mgr.pasteTextScrap(new TextScrap(flow));
0

i used your coding . it is working fine but it is creating new p tag and new line. how do avoid new p tag or new line.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.