灵活键盘插入模式改写或插入

发布于 2024-07-25 07:45:42 字数 111 浏览 5 评论 0原文

在我的 Flex 应用程序中,我想以编程方式了解插入键的编辑模式。 在应用程序的状态栏中应该有一个指示符,指示当前工作的模式。 由于插入键是切换键,我如何知道它的模式?

提前致谢。

In my flex application, I would like to know the edit mode of insert key programmatically. In the status bar of the application there should be an indicator for the mode in which currently working. As the insert key is toggle key, how can i know the mode of it?

Thanks in advance.

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

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

发布评论

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

评论(1

最舍不得你 2024-08-01 07:45:43

您可以使用 KeyboardEvent.KEY_DOWN 和 KeyboardEvent.KEY_UP 记录按下的按键。 您必须在申请完成后将它们添加到舞台上,否则它们将不起作用。

<mx:Application applicationComplete="ApplicationComplete()" etc...

然后有一个函数:

    public function ApplicationComplete():void {
    stage.addEventListener(KeyboardEvent.KEY_DOWN, KeyDown);
    stage.addEventListener(KeyboardEvent.KEY_UP, KeyUp);        
}

然后是事件函数:

    public function KeyDown(e:KeyboardEvent):void {
        if (e.keyCode = whateverTheInsertKeyCodeIs) {
                   isInsertPressed = true;
            }
}
public function KeyUp(e:KeyboardEvent):void {
    if (e.keyCode = whateverTheInsertKeyCodeIs) {
                   isInsertPressed = false;
            }
}

或者如果您将它用作切换:

    public function KeyDown(e:KeyboardEvent):void {
        if (e.keyCode = whateverTheInsertKeyCodeIs) {
                   insertToggle = !insertToggle;
            }
}

我希望这会有所帮助!

You can record the keys being pressed with a KeyboardEvent.KEY_DOWN and KeyboardEvent.KEY_UP. You have to add these to the stage on application complete or they will not work.

<mx:Application applicationComplete="ApplicationComplete()" etc...

And then have a function:

    public function ApplicationComplete():void {
    stage.addEventListener(KeyboardEvent.KEY_DOWN, KeyDown);
    stage.addEventListener(KeyboardEvent.KEY_UP, KeyUp);        
}

And then the event functions:

    public function KeyDown(e:KeyboardEvent):void {
        if (e.keyCode = whateverTheInsertKeyCodeIs) {
                   isInsertPressed = true;
            }
}
public function KeyUp(e:KeyboardEvent):void {
    if (e.keyCode = whateverTheInsertKeyCodeIs) {
                   isInsertPressed = false;
            }
}

Or if you're using it as a toggle:

    public function KeyDown(e:KeyboardEvent):void {
        if (e.keyCode = whateverTheInsertKeyCodeIs) {
                   insertToggle = !insertToggle;
            }
}

I hope this helps!

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