Actionscript 3 Textfield()-如何防止鼠标右键单击菜单
Textfield()-如何防止鼠标右键单击菜单出现(具有复制、粘贴、选择所有等选项的菜单).您尝试过自定义吗?您尝试过自定义吗?将字段Actionscript 3 Textfield()-如何防止鼠标右键单击菜单,actionscript-3,flex3,Actionscript 3,Flex3,Textfield()-如何防止鼠标右键单击菜单出现(具有复制、粘贴、选择所有等选项的菜单).您尝试过自定义吗?您尝试过自定义吗?将字段可选属性设置为false。将字段可选属性设置为false。FlashPlayer默认菜单项。 据我所知,您无法删除有意义的基本FlashPlayer项目(设置和关于) FlashPlayer内置项目 您可以通过在编译时指定或从代码中指定来删除最上面的选项(播放、暂停等): contextMenu.hideBuiltInItems(); 或在全球范围内: sta
可选属性设置为false。将字段可选属性设置为false。FlashPlayer默认菜单项。
据我所知,您无法删除有意义的基本FlashPlayer项目(设置和关于)
FlashPlayer内置项目
您可以通过在编译时指定或从代码中指定来删除最上面的选项(播放、暂停等):
contextMenu.hideBuiltInItems();
或在全球范围内:
stage.showDefaultContextMenu = false;
文本字段相关菜单项
文本字段的复制/粘贴/选择也是内置的,您似乎无法隐藏它们。然而,似乎你真的想摆脱它们,这里有一个解决办法。
下面的示例演示了如何在文本字段上添加透明按钮以侧移鼠标行为:
package
{
import flash.display.Sprite;
import flash.display.Stage;
import flash.events.MouseEvent;
import flash.text.TextField;
import flash.text.TextFieldType;
import flash.ui.ContextMenu;
public class TestText extends Sprite
{
private var textField:TextField;
public function TestText()
{
// Removes the inbuit items from the contextMenu
var contextMenu:ContextMenu = new ContextMenu();
contextMenu.hideBuiltInItems();
this.contextMenu = contextMenu;
// Adds a simple input TextField
textField = addChild(new TextField()) as TextField;
textField.type = TextFieldType.INPUT;
textField.text = "Test Text";
// Covers the TextField with a transparent shape
var shape:Sprite = addChild(new Sprite()) as Sprite;
shape.graphics.beginFill(0, 0);
shape.graphics.drawRect(0, 0, textField.width, textField.height);
shape.mouseChildren = false;
// Listens to a click on the mask to activate typing
shape.addEventListener(MouseEvent.CLICK, eventClickHandler);
}
private function eventClickHandler(event:MouseEvent):void
{
// Sets the focus to the underlaying TextField and makes
// a full selection of the existing text.
stage.focus = textField;
textField.setSelection(0, textField.text.length);
}
}
}
FlashPlayer默认菜单项。
据我所知,您无法删除有意义的基本FlashPlayer项目(设置和关于)
FlashPlayer内置项目
您可以通过在编译时指定或从代码中指定来删除最上面的选项(播放、暂停等):
contextMenu.hideBuiltInItems();
或在全球范围内:
stage.showDefaultContextMenu = false;
文本字段相关菜单项
文本字段的复制/粘贴/选择也是内置的,您似乎无法隐藏它们。然而,似乎你真的想摆脱它们,这里有一个解决办法。
下面的示例演示了如何在文本字段上添加透明按钮以侧移鼠标行为:
package
{
import flash.display.Sprite;
import flash.display.Stage;
import flash.events.MouseEvent;
import flash.text.TextField;
import flash.text.TextFieldType;
import flash.ui.ContextMenu;
public class TestText extends Sprite
{
private var textField:TextField;
public function TestText()
{
// Removes the inbuit items from the contextMenu
var contextMenu:ContextMenu = new ContextMenu();
contextMenu.hideBuiltInItems();
this.contextMenu = contextMenu;
// Adds a simple input TextField
textField = addChild(new TextField()) as TextField;
textField.type = TextFieldType.INPUT;
textField.text = "Test Text";
// Covers the TextField with a transparent shape
var shape:Sprite = addChild(new Sprite()) as Sprite;
shape.graphics.beginFill(0, 0);
shape.graphics.drawRect(0, 0, textField.width, textField.height);
shape.mouseChildren = false;
// Listens to a click on the mask to activate typing
shape.addEventListener(MouseEvent.CLICK, eventClickHandler);
}
private function eventClickHandler(event:MouseEvent):void
{
// Sets the focus to the underlaying TextField and makes
// a full selection of the existing text.
stage.focus = textField;
textField.setSelection(0, textField.text.length);
}
}
}
我找到了一种隐藏文本字段的默认上下文菜单项的方法
只需设置一个自定义上下文菜单,并隐藏内置项。现在,当您右键单击时,什么也不会发生
// hide cut/copy/paste
var cm:ContextMenu = new ContextMenu();
cm.hideBuiltInItems();
textfield.contextMenu = cm;
我找到了一种隐藏文本字段的默认上下文菜单项的方法
只需设置一个自定义上下文菜单,并隐藏内置项。现在,当您右键单击时,什么也不会发生
// hide cut/copy/paste
var cm:ContextMenu = new ContextMenu();
cm.hideBuiltInItems();
textfield.contextMenu = cm;
我想让它保持可选择状态以使光标可见。我想让它保持可选择状态以使光标可见。如果您想要特定情况的答案,您必须在问题中指定答案。我找到了一种方法!!!!检查我的答案…如果你想知道具体情况的答案,你必须在问题中详细说明。我找到了一个方法!!!!检查我的答案……谢谢!我一直在到处找这样的东西!我建议当前的最佳答案也包含此解决方案。谢谢!我一直在到处找这样的东西!我建议当前的最佳答案也包含此解决方案。