而是內MXML的聲明文本流,你可以通過編程方式追加到一個字符串變量,並與TextConverter.importToFlow()
迴流更新文本。
例子:
上輸入,從輸入字段文本附加和迴流:
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
minWidth="955"
minHeight="600">
<fx:Script>
<![CDATA[
import flashx.textLayout.conversion.TextConverter;
import flashx.textLayout.elements.TextFlow;
import mx.events.FlexEvent;
[Bindable]
public var text:String = "<p>Inline<br />TextFlow</p>";
protected function input_enterHandler(event:FlexEvent):void
{
text += input.text;
input.text = null;
}
]]>
</fx:Script>
<s:layout>
<s:VerticalLayout />
</s:layout>
<s:TextInput id="input"
enter="input_enterHandler(event)" />
<s:RichEditableText editable="false"
selectable="true"
textFlow="{TextConverter.importToFlow(text, TextConverter.TEXT_FIELD_HTML_FORMAT)}"
buttonMode="true"
width="100%"
height="100%" />
</s:Application>
很大......... –
我怎樣才能爲HTML設置內聯樣式?因爲我試圖設置樣式=「顏色:紅色」,它不起作用,這是可能的嗎? –
This Works:' RED' –