0

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>

どんな助けでもいただければ幸いです。

乾杯、

4

2 に答える 2

0
<s:TextArea id="txt_ar"  textAlign="justify"
borderAlpha="0" editable="false">

次に、urhtml文字列を記述します

textrichtml:String = "your html string"

次に、次のコードを使用します。

txt_ar.textFlow = TextConverter.importToFlow(textrichtml,TextConverter.TEXT_FIELD_HTML_FORMAT);
于 2012-04-15T18:09:20.433 に答える
0

Flex 4.0 では、htmlText プロパティが TextArea から削除され、コンテンツ プロパティまたは 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 で 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>
于 2012-04-20T07:52:54.263 に答える