将 Flex RTE HtmlText 导入到 TLF TextFlow
我是 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);
同时我删除了标签并且它可以工作,但问题仍然存在。
提前致谢!
I am working as a developer on a Flex/Air application and we are using the buggy Flex RTE (RichTextEditor) to let the user manage his notes. At the moment I am trying to evaluate how costly it would be for us to build a new text component using the TLF (Text Layout Framework).
Really important is the question if we can import the HTML text, produced by the RTE straight away. I know that there are some limitations regarding lists with TLF 1.1, but does it work in general?
I have just tried to grab some HTML formatted text from RTE like:
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>'
when I pass this to the TextConverter like this:
var textFlow:TextFlow = TextConverter.importToFlow(htmlText, TextConverter.HTML_FORMAT);
The Flash Player throws an exception. I also tried to wrap the text with
<html><body></body></html>
, but same issue. So it does not seem to work straight away. What are you experiences? This is really critical to us.
UPDATE 1:
When I try to import the HTML like above (same variable declaration) I get this error:
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);
Meanwhile I removed the tags and it works, but the question still remains.
Thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
查看 http://help .adobe.com/en_US/FlashPlatform/reference/actionscript/3/flashx/textLayout/conversion/TextConverter.html
格式有三个常量,其中没有一个似乎不是您使用的:
此外,格式以下“html”代码看起来更像是 TLF 格式的 XML,而不是 HTML。
Take a look at http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flashx/textLayout/conversion/TextConverter.html
There are three constants for the format, none of which seems to be what you used:
Also, the format of the following "html" code looks more like TLF-formatted XML than HTML.