我作为 Flex/Air 应用程序的开发人员工作,我们正在使用有问题的 Flex RTE (RichTextEditor) 让用户管理他的笔记。目前,我正在尝试评估使用 TLF(文本布局框架)构建新文本组件的成本。
真正重要的是我们是否可以导入由 RTE 直接生成的 HTML 文本。我知道 TLF 1.1 的列表存在一些限制,但它一般都有效吗?
我刚刚尝试从 RTE 中获取一些 HTML 格式的文本,例如:
var htmlText:String = '<TEXTFORMAT LEADING="2"><P ALIGN="LEFT"><FONT FACE="defaultFont" SIZE="14" COLOR="#000000" LETTERSPACING="0" KERNING="0">1hr run on Wednesday - feeling ok!</FONT></P></TEXTFORMAT>'
当我像这样将它传递给 TextConverter 时:
var textFlow:TextFlow = TextConverter.importToFlow(htmlText, TextConverter.HTML_FORMAT);
Flash Player 引发异常。我也尝试用
<html><body></body></html>
,但同样的问题。所以它似乎并没有立即起作用。你有什么经验?这对我们来说真的很重要。
更新 1:
当我尝试像上面那样导入 HTML(相同的变量声明)时,我收到此错误:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at flashx.textLayout.formats::TextLayoutFormatValueHolder/apply()[C:\Vellum\branches\v1\1.0\dev\textLayout_core\src\flashx\textLayout\formats\TextLayoutFormatValueHolder.as:357]
at HtmlImporter$/parseTextFormat()[C:\Vellum\branches\v1\1.0\dev\textLayout_conversion\src\flashx\textLayout\conversion\HtmlImporter.as:307]
at BaseTextLayoutImporter/parseObject()[C:\Vellum\branches\v1\1.0\dev\textLayout_conversion\src\flashx\textLayout\conversion\BaseTextLayoutImporter.as:464]
at BaseTextLayoutImporter/parseFlowGroupElementChildren()[C:\Vellum\branches\v1\1.0\dev\textLayout_conversion\src\flashx\textLayout\conversion\BaseTextLayoutImporter.as:419]
at HtmlImporter$/parseHtmlContainer()[C:\Vellum\branches\v1\1.0\dev\textLayout_conversion\src\flashx\textLayout\conversion\HtmlImporter.as:269]
at BaseTextLayoutImporter/parseObject()[C:\Vellum\branches\v1\1.0\dev\textLayout_conversion\src\flashx\textLayout\conversion\BaseTextLayoutImporter.as:464]
at HtmlImporter/importFromXML()[C:\Vellum\branches\v1\1.0\dev\textLayout_conversion\src\flashx\textLayout\conversion\HtmlImporter.as:142]
at HtmlImporter/importFromString()[C:\Vellum\branches\v1\1.0\dev\textLayout_conversion\src\flashx\textLayout\conversion\HtmlImporter.as:130]
at BaseTextLayoutImporter/importToFlow()[C:\Vellum\branches\v1\1.0\dev\textLayout_conversion\src\flashx\textLayout\conversion\BaseTextLayoutImporter.as:73]
at flashx.textLayout.conversion::TextConverter$/importToFlow()[C:\Vellum\branches\v1\1.0\dev\textLayout_conversion\src\flashx\textLayout\conversion\TextConverter.as:87]
at TLFTestApp/init()[/Users/Arne/Documents/Adobe Flash Builder 4/TLFRichTextEditor/src/TLFTestApp.mxml:29] <-- // executing TextConverter.importToFlow(htmlText, TextConverter.HTML_FORMAT);
同时我删除了标签并且它可以工作,但问题仍然存在。
提前致谢!