开发者

Insert text at cursor in a TLF-based Flex Spark RichEditableText?

I want to programmatically insert formatted text at the current curso开发者_StackOverflow中文版r 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.


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));


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜