检测 RichEditableText 上的右键单击

发布于 2024-12-11 08:58:01 字数 664 浏览 0 评论 0原文

我目前正在 Flex 应用程序中实现 squiggly 以启用拼写检查。由于某些要求,我无法使用 SquigglyUI 来连接我的 Spark RichEditableText。我已成功使用 com.adobe.linguistics.utils.TextTokenizer 来标记并突出显示拼写错误的单词。

我希望能够让用户右键单击拼写错误的单词,并使用 getSuggestions 在上下文菜单中显示建议列表。

我尝试将侦听器附加到我的 RichEditableText:

richtexteditor.addEventListener("rightClick", showSuggestions);

这是我的事件处理程序:

private function showSuggestions(event:MouseEvent):void{
    trace('hi there');
}

问题是在调试应用程序时,我从未在控制台中获得跟踪,因为从未调度右键单击事件。此外,我需要检测用户右键单击的单词。我该如何执行此操作以及如何检测右键单击?

干杯

I am currently implementing squiggly in a flex application to enable spell checking. Due to certain requirements, I can not use SquigglyUI to hook onto my spark RichEditableText. I have successfully used com.adobe.linguistics.utils.TextTokenizer to tokenize and highlight mispelt words.

I would like to be able to let the user rightclick on a mispelled word and show a list of suggestions in the context menu using getSuggestions.

I have tried to attach a listener to my RichEditableText:

richtexteditor.addEventListener("rightClick", showSuggestions);

And this is my event handler:

private function showSuggestions(event:MouseEvent):void{
    trace('hi there');
}

The problem is when debugging the application, I never get the trace in my console as the rightclick event is never dispatched. In addition, I need to detect the word the user has right clicked on. How can I go about doing this and how can I detect right clicks?

Cheers

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(2

水溶 2024-12-18 08:58:01

我所要做的就是向 Richeditable 文本的 contextmenu 属性添加一个事件处理程序:

richtexteditor.contextMenu.addEventListener(ContextMenuEvent.MENU_SELECT, doSomething);

All I had to do was add an event handler to the contextmenu property of the richeditable text:

richtexteditor.contextMenu.addEventListener(ContextMenuEvent.MENU_SELECT, doSomething);
゛时过境迁 2024-12-18 08:58:01
r.addEventListener(MouseEvent.RIGHT_CLICK, listener)

这将监听鼠标右键(Flex4.5)

r.addEventListener(MouseEvent.RIGHT_CLICK, listener)

This will listen for the right-click of the mouse (Flex4.5)

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