0

I have some issue with this code :

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

When running the text is show without space :

"some textwith tab"


Solved

I finaly find the solution:

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);
Community
  • 1
  • 1
Fred
  • 399
  • 3
  • 12
  • You can post an answer to your question (see http://stackoverflow.com/help/self-answer). – Brian Jun 29 '14 at 05:01

1 Answers1

1

Flex's "text field HTML format" only supports a subset of HTML tags:

anchor <a>
bold <b>
break <br>
font <font>
image <img>
italic <i>
list item <li>
paragraph <p>
text format <textformat>

You should get better results if you replace <tab /> with /t in your sample string.

Brian
  • 3,850
  • 3
  • 21
  • 37