在AS3调度粘贴事件 [英] Dispatch Paste Event in AS3

查看:255
本文介绍了在AS3调度粘贴事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的AS3 code与实例名称的文本框 myTextBox 放置在舞台上 -

This is my AS3 code for a textbox with an instance name of myTextBox placed on stage -:

import flash.display.*;
import flash.events.*;

myTextBox.text = 'Hello India';
myTextBox.addEventListener(Event.PASTE, onPaste)

function onPaste(e:Event):void
{
    trace("lol");
}

但是,当我粘贴一些文本到文本框,什么都不会发生。想不通的问题。感谢您的帮助......

But when i paste some text into the text box, nothing happens. Can't figure out the issue. Thanks for help...

推荐答案

根据该文件<一个href="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/events/Event.html#PASTE" rel="nofollow">http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/events/Event.html#PASTE:

请注意:T​​extField对象不明确的调度,复制,剪切,粘贴,或   selectAll事件。 TextField对象始终包括剪切,复制,粘贴,   清除,然后在上下文菜单中的所有命令。无法删除   这些命令从TextField对象的上下文菜单。对于   TextField对象,选择这些命令(或他们的键盘   当量)不会生成clear,复制,剪切,粘贴,或全选   事件。然而,其他类扩展InteractiveObject   类,包括使用Flash文本引擎(FTE)构建的组件,   将响应于用户操作,例如调度这些事​​件   键盘快捷键和上下文菜单。

Note: 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), will dispatch these events in response to user actions such as keyboard shortcuts and context menus.

所以,最简单的方法是使用TLF文本字段。 (请确保发布为Flash Player 10)

So the easiest option is to use a TLF TextField. (Make sure to publish for Flash Player 10)

这篇关于在AS3调度粘贴事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆