有没有办法允许在 CTRL-V 之上使用 Shift-Insert 从剪贴板进行粘贴?

发布于 2024-08-21 09:10:39 字数 213 浏览 5 评论 0原文

我知道您可以通过在控件中单击鼠标右键来使用上下文菜单来选择剪切、复制、粘贴等。我还注意到您可以使用 Windows 键盘快捷键 CTRL-C 进行复制和 CTRL -V 表示粘贴。

Windows 支持本机 CTRL-Insert(用于复制)和 SHIFT-Insert(用于粘贴)。

然而,在 Flex 中,这些似乎不起作用。有谁能够允许这些键盘事件吗?任何解决方案表示赞赏。

I know that you can use the context menu using a right-mouse-click in a control to choose to cut, copy, paste, etc. I've also noticed that you can use the windows keyboard shortcuts CTRL-C for Copy and CTRL-V for Paste.

Windows supports native CTRL-Insert (for copy) and SHIFT-Insert (for paste).

However, within Flex, it seems these do not appear to work. Has anyone been able to either allow these keyboard events? Any solutions are appreciated.

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

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

发布评论

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

评论(2

没企图 2024-08-28 09:10:39

Clipboard 类从 Flash Player 10 开始可用。

Clipboard class is available starting from Flash Player 10.

流云如水 2024-08-28 09:10:39

注意:操作系统和 Web 浏览器将先于 Adob​​e Flash Player 或 AIR 处理键盘事件。例如,在 Microsoft Internet Explorer 中,按 Ctrl+W 会在任何包含的 SWF 文件调度键盘事件之前关闭浏览器窗口。

您可以执行与此类似的操作

<?xml version="1.0" encoding="utf-8"?>

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
 layout="absolute" creationComplete="init()">

 <mx:Script>

 <![CDATA[

    private function init():void{

     this.addEventListener(MouseEvent.CLICK, clickHandler);

     this.addEventListener(KeyboardEvent.KEY_DOWN,keyPressed);

    }

    private function clickHandler(event:MouseEvent):void {

      stage.focus = this;

    }

    private function keyPressed(evt:KeyboardEvent):void{

       if(evt.ctrlKey && evt.keyCode == 65)

             trace("CTRL A is pressed");

       if(evt.ctrlKey && evt.keyCode == 66)

             trace("CTRL B is pressed");

   }

 ]]>

 </mx:Script>

</mx:Application>

然后写入操作系统剪贴板:

import flash.desktop.ClipboardFormats;

 var copy:String = "A string to copy to the system clipboard.";
 Clipboard.generalClipboard.clear();
 Clipboard.generalClipboard.setData(ClipboardFormats.TEXT_FORMAT, copy);

从操作系统剪贴板读取:

import flash.desktop.ClipboardFormats;

 var pasteData:String  = Clipboard.generalClipboard.getData(ClipboardFormats.TEXT_FORMAT) as String;

Note: The operating system and the web browser will process keyboard events before Adobe Flash Player or AIR. For example, in Microsoft Internet Explorer, pressing Ctrl+W closes the browser window before any contained SWF file dispatches a keyboard event.

You can just do something similar to this

<?xml version="1.0" encoding="utf-8"?>

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
 layout="absolute" creationComplete="init()">

 <mx:Script>

 <![CDATA[

    private function init():void{

     this.addEventListener(MouseEvent.CLICK, clickHandler);

     this.addEventListener(KeyboardEvent.KEY_DOWN,keyPressed);

    }

    private function clickHandler(event:MouseEvent):void {

      stage.focus = this;

    }

    private function keyPressed(evt:KeyboardEvent):void{

       if(evt.ctrlKey && evt.keyCode == 65)

             trace("CTRL A is pressed");

       if(evt.ctrlKey && evt.keyCode == 66)

             trace("CTRL B is pressed");

   }

 ]]>

 </mx:Script>

</mx:Application>

Then To write to the operating system clipboard:

import flash.desktop.ClipboardFormats;

 var copy:String = "A string to copy to the system clipboard.";
 Clipboard.generalClipboard.clear();
 Clipboard.generalClipboard.setData(ClipboardFormats.TEXT_FORMAT, copy);

To read from the operating system clipboard:

import flash.desktop.ClipboardFormats;

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