PDA

View Full Version : TextArea component - Disallow copy and paste


andrea_muta
03-13-2007, 03:07 PM
Hello.

How can I disable the possibility of selecting text on a TextArea component?

I have tried...
myTextArea.selectable = false;

and...
myTextArea.editable= false;

and..
myTextArea.enabled= false;

...this last one does it, but it also disable the scrolling bar which I want to be able to use.

Thanks.

Mazoonist
03-15-2007, 12:44 AM
I found the answer for you on this page:

http://livedocs.adobe.com/flash/mx2004/main_7_2/wwhelp/wwhimpl/common/html/wwhelp.htm?context=Flash_MX_2004&file=00002833.html
Here's what works:

myText.label.selectable = false;

substitute the name of your TextArea component for "myText"

andrea_muta
03-22-2007, 10:06 AM
Hello and thanks for your reply.

Unfortunately this won't work for me since the property "selectable" is part of the TextField class and not for the TextInput class, which is the one I am using.

The TextInput class has a similar property, "enabled". Unfortunately by doing...
myTextInput.enabled = false;...sets the entire component on a disable state, meaning that the text will appear with a grey colour, I could change that appearance by changing back its colour to black using...
myTextInput.setStyle("disabledColor", 0x000000);...but I still have a problem with its scrollBar which remains disable.

Do you guys know how to act over the TextInput's scrollBar so I override its state to enabled? How can I get a reference to that scrollBar?

Thanks.

andrea_muta
03-22-2007, 10:24 AM
Hi Mazoonist.

I didn't read your solution properly, I missed that "label" part.

Your solution works.

Also, investigating the TextInput component I found out that this works as well...
myTextArea.focusTextField.selectable = false;
Thanks for your help.