我对这段代码有一些问题:
<s:RichEditableText id="ta" width="100%" height="200" selectable="true" editable="true"/>
<fx:Script>
<![CDATA[
var str:String = "some text<tab/>with tab";
ta.textFlow = TextConverter.importToFlow(str, TextConverter.TEXT_FIELD_HTML_FORMAT);
]]>
</fx:Script>
运行文本时显示没有空格:
“一些带有标签的文本”
解决了
我终于找到了解决方案:
var config:Configuration = Configuration(ta.textFlow.configuration);
var format:TextLayoutFormat = new TextLayoutFormat();
format.whiteSpaceCollapse = WhiteSpaceCollapse.PRESERVE;
config.textFlowInitialFormat = format;
ta.textFlow = TextConverter.importToFlow(str, TextConverter.TEXT_FIELD_HTML_FORMAT,config);