views:

892

answers:

4

How to prevent ctrl+v paste for flash.display.textarea()?

field.selectable = false; does not seem to work, also it disables caret/cursor

+1  A: 

this seem to work in TextEvent listener, any comments is it too bad solution to avoid copy+paste to a field ?

if (evt.text.length >1) 
evt.preventDefault () ;
Tom
+1  A: 

A TextArea is an editable textfield. You should use another component if you want to prevent copy / paste.

monkee
A: 

If you can, use a different component instead of TextArea, as monkee suggested.

If you're really into protecting against copying your text data you might even want to consider drawing the text on a canvas directly so it's really impossible to grab it unless the user does OCR or something.

Assaf Lavie
any ideas where I can find such a component, actionscript3?
Tom
A: 

The TextArea component has a textField property. Setting the mouseEnabled property of the textField should have the desired effect.

var ta:TextArea = new TextArea();
ta.textField.mouseEnabled = false;

This disables the caret cursor and prevents selection of the text.

jordan