Same question asked on
<http://stackoverflow.com/questions/35151142/flex-sdk-how-to-assign-tabs-to-a-spark-richttext-with-textlayoutframework>
I'm experimenting with the TextLayoutFramework to try to use tabs. Based on
some examples this should work, but doesn't...
Any ideas why the txt is shown as follows with spaces instead of linebreaks or
tabs?
1111112222223333344444555556666677777
This is the code used:
<fx:Script> <![CDATA[ importflash.text.engine.TabAlignment;
importflashx.textLayout.conversion.TextConverter;
importflashx.textLayout.formats.TabStopFormat;
importflashx.textLayout.formats.TextLayoutFormat; privatefunctionsetText():void
{ // Test content
vartxt:String="<p><span>111111\n222222\t33333\t44444\t55555\n66666\t77777</span></p>";
varxml:XML=newXML("<TextFlow
xmlns='<http://ns.adobe.com/textLayout/2008>'>"+txt+"</TextFlow>"); // Define
three tab positions vartabStop1:TabStopFormat=newTabStopFormat();
tabStop1.alignment=TabAlignment.START; tabStop1.position=50;
vartabStop2:TabStopFormat=newTabStopFormat();
tabStop2.alignment=TabAlignment.CENTER; tabStop2.position=150;
vartabStop3:TabStopFormat=newTabStopFormat();
tabStop3.alignment=TabAlignment.END; tabStop3.position=250; // Define the
formatter varformat:TextLayoutFormat=newTextLayoutFormat();
format.tabStops=newArray(tabStop1,tabStop2,tabStop3); // Put the text in the
textbox
txtBox.textFlow=TextConverter.importToFlow(xml,TextConverter.TEXT_LAYOUT_FORMAT);
// Assign the formatter to the textbox txtBox.textFlow.format=format; } ]]>
</fx:Script> <s:RichTextid="txtBox"top="25"left="25"width="400"height="200"/>