Flex 4 通过“单击”添加 TextFlow 锚点事件
给出以下内容:
private var errorHtml:String = "<TextFlow xmlns=\"http://ns.adobe.com/textLayout/2008\"><p>Existing account, please <a click=\"clickHandler(event);\">click here</a>.</p></TextFlow>";
然后在创建完成时导入它:
errorMessageText.textFlow = TextConverter.importToFlow(errorHtml, TextConverter.TEXT_LAYOUT_FORMAT);
单击处理程序函数永远不会触发。但如果我将其直接添加到标记中:
<s:textFlow>
<s:TextFlow>
<s:p>
Existing account, please <a click=\"clickHandler(event);\">click here</a>.
</s:p>
</s:TextFlow>
</s:textFlow>
该事件会正常触发。我发现如果您尝试导入为 TEXT_FIELD_HTML_FORMAT,这些事件会被删除:
注意:与 TextField 类不同,不支持 ActionScript 链接事件。 a:link、a:hover 和 a:active 样式也不是。
它们是否也使用 TEXT_LAYOUT_FORMAT 删除?
Given the following:
private var errorHtml:String = "<TextFlow xmlns=\"http://ns.adobe.com/textLayout/2008\"><p>Existing account, please <a click=\"clickHandler(event);\">click here</a>.</p></TextFlow>";
Then importing it on creationComplete:
errorMessageText.textFlow = TextConverter.importToFlow(errorHtml, TextConverter.TEXT_LAYOUT_FORMAT);
The click handler function never fires. But if I add it directly to the markup:
<s:textFlow>
<s:TextFlow>
<s:p>
Existing account, please <a click=\"clickHandler(event);\">click here</a>.
</s:p>
</s:TextFlow>
</s:textFlow>
The event fires fine. I saw that these events get removed if you try to import as TEXT_FIELD_HTML_FORMAT:
Note: Unlike the TextField class, ActionScript link events are not supported. Neither are a:link, a:hover, and a:active styles.
Are they also removed using TEXT_LAYOUT_FORMAT?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的,它摆脱了所有“FlowElementMouseEvent”事件,烦人。基本上导入后,您需要返回并找到所有链接,然后添加
FlowElementMouseEventhandler
。这里有一篇博客文章: http://flexdevtips.blogspot .com/2010/10/displaying-html-text-in-labels.html 讨论了如何做到这一点。Yea, it gets rid of all the 'FlowElementMouseEvent' events, annoying. Basically after importing you need to go back through and find all the links and then add
FlowElementMouseEventhandler
s. There's a blog post here: http://flexdevtips.blogspot.com/2010/10/displaying-html-text-in-labels.html which discusses how to do it.