Flex 4 通过“单击”添加 TextFlow 锚点事件

发布于 2024-11-19 21:37:43 字数 895 浏览 5 评论 0原文

给出以下内容:

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

可可 2024-11-26 21:37:43

是的,它摆脱了所有“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 FlowElementMouseEventhandlers. There's a blog post here: http://flexdevtips.blogspot.com/2010/10/displaying-html-text-in-labels.html which discusses how to do it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文