ActionScript - 访问文本字段上下文菜单事件?

发布于 2024-09-25 23:45:16 字数 111 浏览 1 评论 0原文

TextField 对象有一个内置的上下文菜单,其中包含针对剪切、复制、粘贴、删除和选择所有事件的项目。

我想将键盘按键和修饰符映射到这些事件以获得它们的免费功能。

这可能吗?

TextField objects have a built in context menu containing items which target cut, copy, paste, delete and select all events.

i would like to map keyboard keys and modifiers to these events to obtain their free functionality.

is that possible?

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

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

发布评论

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

评论(1

在巴黎塔顶看东京樱花 2024-10-02 23:45:16

来自文档(InteractiveObject 类):

TextField 对象不分派
清除、复制、剪切、粘贴或全选
事件。 TextField 对象始终
包括剪切、复制、粘贴、清除和
选择上下文中的所有命令
菜单。您无法删除这些命令
从 TextField 的上下文菜单
对象。对于 TextField 对象,
选择这些命令(或它们的
键盘等效项)不
生成清晰、复制、剪切、粘贴或
选择所有事件。然而,其他
扩展的类
InteractiveObject类,包括
使用 Flash Text 构建的组件
引擎(FTE),可以调度这些
事件。

在 AIR 中,完成此操作非常简单,因为它们是 NativeApplication 类的内置公共方法。

NativeApplication.nativeApplication.cut();        //Cut
NativeApplication.nativeApplication.copy();       //Copy
NativeApplication.nativeApplication.paste();      //Paste
NativeApplication.nativeApplication.clear();      //Delete
NativeApplication.nativeApplication.selectAll();  //Select All

from the documentation (InteractiveObject Class):

TextField objects do not dispatch
clear, copy, cut, paste, or selectAll
events. TextField objects always
include Cut, Copy, Paste, Clear, and
Select All commands in the context
menu. You cannot remove these commands
from the context menu for TextField
objects. For TextField objects,
selecting these commands (or their
keyboard equivalents) does not
generate clear, copy, cut, paste, or
selectAll events. However, other
classes that extend the
InteractiveObject class, including
components built using the Flash Text
Engine (FTE), can dispatch these
events.

in AIR, it's mind-numbingly simple to accomplish this, as they are built-in public methods of the NativeApplication class.

NativeApplication.nativeApplication.cut();        //Cut
NativeApplication.nativeApplication.copy();       //Copy
NativeApplication.nativeApplication.paste();      //Paste
NativeApplication.nativeApplication.clear();      //Delete
NativeApplication.nativeApplication.selectAll();  //Select All
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文