首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >将Flex导入TLF TextFlow

将Flex导入TLF TextFlow
EN

Stack Overflow用户
提问于 2011-01-05 19:09:44
回答 1查看 3.3K关注 0票数 1

我是一名Flex/Air应用程序的开发人员,我们使用buggy Flex RTE (RichTextEditor)让用户管理他的笔记。目前,我正在尝试评估使用TLF (文本布局框架)构建一个新的文本组件的成本有多高。

真正重要的问题是,我们是否可以直接导入由RTE生成的HTML文本。我知道TLF 1.1中的列表有一些限制,但它通常能正常工作吗?

我刚刚尝试从RTE抓取一些HTML格式的文本,如下所示:

代码语言:javascript
复制
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时:

代码语言:javascript
复制
var textFlow:TextFlow = TextConverter.importToFlow(htmlText, TextConverter.HTML_FORMAT);

Flash播放器抛出异常。我还尝试用以下方式对文本进行换行

代码语言:javascript
复制
<html><body></body></html>

,但是相同的问题。因此,它似乎不会立即起作用。你有什么经验?这对我们来说真的很关键。

更新1:

当我尝试像上面那样导入HTML (相同的变量声明)时,我得到这个错误:

代码语言:javascript
复制
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);

同时,我去掉了标签,它起作用了,但问题仍然存在。

提前感谢!

EN

回答 1

Stack Overflow用户

发布于 2011-01-18 11:35:05

看一看http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flashx/textLayout/conversion/TextConverter.html

格式有三个常量,似乎都不是您使用的常量:

代码语言:javascript
复制
PLAIN_TEXT_FORMAT
TEXT_FIELD_HTML_FORMAT
TEXT_LAYOUT_FORMAT

而且,下面的" HTML“代码的格式看起来更像是TLF格式的XML,而不是HTML。

代码语言:javascript
复制
<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>
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/4603384

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档