下面的代码运行良好...
<?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" >
<fx:Declarations>
<mx:HTTPService id="httpRSS" url="http://www.petefreitag.com/rss/" resultFormat="object" />
</fx:Declarations>
<s:Panel id="reader" title="Blog Reader" width="500">
<mx:DataGrid width="485" id="entries" dataProvider="{httpRSS.lastResult.rss.channel.item}" click="{body.htmlText=httpRSS.lastResult.rss.channel.item[entries.selectedIndex].description}">
<mx:columns>
<mx:DataGridColumn dataField="title" headerText="TITLE"/>
<mx:DataGridColumn dataField="pubDate" headerText="Date"/>
</mx:columns>
</mx:DataGrid>
<mx:TextArea id="body" editable="false" width="485" x="3" y="142" height="155"/>
</s:Panel>
<s:Button label="Load" x="10" y="329" click="{httpRSS.send()}"/>
</s:Application>
但是当 Textarea 更改为 Spark Textarea 时,如下所示
<s:TextArea id="body" editable="false" width="485" x="3" y="142" height="155"/>
那么htmlText不支持Spark Textarea。因此产生错误。如何使用 Spark 文本区域属性显示 HTML 格式的文本。
如果您正在使用丰富的可编辑文本相反,您可以使用 TextConverter 类以这种方式完成此操作
var myStr:String = "I contain <b>html</b> tags!";
myRichEditableText.textFlow = TextConverter.importToFlow(myStr, TextConverter.TEXT_FIELD_HTML_FORMAT);
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)