【问题标题】:how to import an html richly formatted text into a textflow at runtime?如何在运行时将 html 格式丰富的文本导入文本流?
【发布时间】:2011-05-14 11:05:09
【问题描述】:

我正在尝试这个:

打开谷歌文档,新建文档,然后输入: 你好世界

(世界粗体)

然后将其下载为 html(压缩)

我解压 html 文件,并将其保存到我的 Flex 应用程序的 src 文件夹中的 assets 文件夹中

我有一个 Spark:TextArea 实例,我想做:

var importer:ITextImporter = TextConverter.getImporter(TextConverter.TEXT_FIELD_HTML_FORMAT);
myTextArea.textFlow = importer.importToFlow(htmlSource);

htmlSource 应该以某种方式指向保存的 html 文件的位置

我该怎么做?我尝试嵌入,转换为 ByteArrayAsset 和 String,但我总是得到 html 文件的源,而不是呈现富文本(即“hello world)。

这是运行时的 i c:

无标题文档{margin:0;padding:0}p{margin:0}.c0{color:#000000;font-size:11pt;font-family:Arial;font-weight:bold}.c3{line -height:1.15;text-indent:0pt;direction:ltr}.c2{color:#000000;font-size:11pt;font-family:Arial}.c1{background-color:#ffffff} 你好世界

我说清楚了吗? 有什么帮助吗? 谢谢

【问题讨论】:

  • 问题很清楚,并尝试了下载的googleDocs,但从我所见的情况来看,flex只能识别一些基本的html标签。之前在组件上使用过 htmlText 但它只识别 等,而不是整个 Html 文件。

标签: html apache-flex actionscript-3 import richtext


【解决方案1】:

我建议查看Text Converter Reference 以了解支持的内容,并尝试使用<s:RichText><s:RichEditableText>

【讨论】:

    猜你喜欢
    • 2021-01-23
    • 1970-01-01
    • 2023-03-28
    • 2010-12-21
    • 2011-05-27
    • 1970-01-01
    • 2012-07-28
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多