尝试在textarea控件中显示HTML文本

尝试在textarea控件中显示HTML文本,html,apache-flex,textarea,Html,Apache Flex,Textarea,我已创建textArea元素,但无法显示HTML内容。如果我只是显示普通文本,或者如果我将textArea元素更改为RichEditableText元素,它就可以正常工作。因为这是一个移动应用程序,我更喜欢使用Adobe推荐的textArea元素 这是textArea的MXML代码。我得到的只是边框,没有显示任何内容 <s:TextArea id="myHelp" editable="false" width="100%" height="100%"> <s:textFlow&

我已创建textArea元素,但无法显示HTML内容。如果我只是显示普通文本,或者如果我将textArea元素更改为RichEditableText元素,它就可以正常工作。因为这是一个移动应用程序,我更喜欢使用Adobe推荐的textArea元素

这是textArea的MXML代码。我得到的只是边框,没有显示任何内容

<s:TextArea id="myHelp" editable="false" width="100%" height="100%">
<s:textFlow>
  <s:TextFlow>
    <s:p fontSize="20">Version: 1.0.0.1</s:p>
       </s:TextFlow>
     </s:textFlow>
</s:TextArea>

版本:1.0.0.1
任何帮助都将不胜感激

干杯

<s:TextArea id="txt_ar"  textAlign="justify"
borderAlpha="0" editable="false">
然后使用下面的代码

txt_ar.textFlow = TextConverter.importToFlow(textrichtml,TextConverter.TEXT_FIELD_HTML_FORMAT);

在Flex 4.0中,在TextArea中删除htmlText属性,您可以使用content属性或TextConverter

<?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">
    <s:layout>
        <s:BasicLayout />
    </s:layout>
    <fx:Script>
        <![CDATA[
            import flashx.textLayout.conversion.TextConverter;
        ]]>
    </fx:Script>
    <fx:Declarations>
        <!-- Place non-visual elements (e.g., services, value objects) here -->
        <fx:String id="htmlSample">
            <![CDATA[This is <font color="#EE1122">HTML text</font> in a <b>TextArea control</b>. Use the <u>textFlow property</u> of the <font color="#22A050">TextArea control</font> to include basic HTML markup in your text.</s:a>.
        ]]></fx:String>
    </fx:Declarations>
    <s:VGroup left="10" right="10" top="10" bottom="10">
        <s:TextArea id="htmlDisplay" width="400" height="100" editable="false">
            <s:content>This is <s:span color="#FF0000">HTML text</s:span>
                in an <s:span fontWeight="bold">Spark TextArea control</s:span>.
                Use the <s:span textDecoration="underline">content</s:span> property
                of the <s:span color="#008800">Spark TextArea control</s:span> 
                to include basic HTML markup in your text, including
                <s:a href="http://www.adobe.com" target="_blank">links</s:a>.
            </s:content>
        </s:TextArea>

        <s:TextArea width="400" height="100" editable="false" textFlow="{TextConverter.importToFlow(htmlSample, TextConverter.TEXT_FIELD_HTML_FORMAT)}">
        </s:TextArea>
    </s:VGroup>
</s:Application>

TextArea控件中的HTML文本。使用TextArea控件的textFlow属性在文本中包含基本HTML标记。。
]]>
这是HTML文本
在火花区域控制中。
使用内容属性
火花区域控制
在文本中包含基本HTML标记,包括
链接。
或者在TextArea中使用htmlText属性

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical">
    <mx:Script>
        <![CDATA[
            [Bindable]
            private var _htmlText:String = "This is 14 point blue italic text.<br><b><font color='#000000' size='10'>This text is 10 point black, italic, and bold.</font></b>";
        ]]>
    </mx:Script>

    <mx:TextArea width="400" height="60" color="0x323232">
        <mx:htmlText><![CDATA[This is <font color="#EE1122">HTML text</font> in a <b>TextArea control</b>. Use the <u>htmlText property</u> of the <font color="#22A050">TextArea control</font> to include basic HTML markup in your text.]]></mx:htmlText>
    </mx:TextArea>

    <mx:TextArea width="100%" height="60" color="blue" fontStyle="italic" fontSize="14" htmlText="{_htmlText}"
                 editable="false" selectable="false"/>

</mx:Application>

TextArea控件中的HTML文本。使用TextArea控件的htmlText属性在文本中包含基本HTML标记。]]>

谢谢,但这也不行。经过更多的研究,我发现一篇帖子指出Adobe不支持在手机皮肤上带有文本区域的TLF。但是Adobe建议在手机上使用textArea而不是RichEditableText。难以置信。[连结]
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical">
    <mx:Script>
        <![CDATA[
            [Bindable]
            private var _htmlText:String = "This is 14 point blue italic text.<br><b><font color='#000000' size='10'>This text is 10 point black, italic, and bold.</font></b>";
        ]]>
    </mx:Script>

    <mx:TextArea width="400" height="60" color="0x323232">
        <mx:htmlText><![CDATA[This is <font color="#EE1122">HTML text</font> in a <b>TextArea control</b>. Use the <u>htmlText property</u> of the <font color="#22A050">TextArea control</font> to include basic HTML markup in your text.]]></mx:htmlText>
    </mx:TextArea>

    <mx:TextArea width="100%" height="60" color="blue" fontStyle="italic" fontSize="14" htmlText="{_htmlText}"
                 editable="false" selectable="false"/>

</mx:Application>