使用TextArea可以禁止复制粘贴,但是Link链接是可以。
public function addTextArea(x : int, y : int) : TextArea {
var text : TextArea = new TextArea();
text.name = "TextArea";
text.setStyle("upSkin", new Sprite());
text.setStyle("focusRectSkin", new Sprite());
text.setStyle("textFormat", new TextFormat("宋体", 12, 0xFFFFFF, null, null, null, null, null, null, null, null, null, 2));
text.textField.selectable = false;
SpriteUtil.setScrollPaneStyle(text);
text.x = x;
text.y = y;
text.editable = false;
text.addEventListener(Event.RENDER, onDescriptionRender);
return text;
}
// 使textArea的文本框不可选
private function onDescriptionRender(evt : Event) : void {
var textArea : TextArea = evt.target as TextArea;
textArea.textField.selectable = false;
}