How to disable copy / paste in Flex Text controls?

In short, I need to add text to my Flex application, and I don't want users to be able to copy. I was going to use a shortcut, but apparently the labels do not support text wrapping. Can I make it so that users cannot select text in a Text Text control?

Thank.

+3
source share
3 answers

You can use the Text control and set the selectable property to false ...

 <mx:Text width="175" selectable="false" text="This is an example of a multiline text string in a Text control." />
+6
source

You can disable insertion of more than 1 character by capturing the textInput event:


private function onTextInput(e:flash.events.TextEvent):void
{
  if (e.text.length > 1) 
    e.preventDefault();
}

+2
source

enabled "false", . disabledcolor .

print("
        <mx:Text enabled="false" disabledColor="0x000000" text=Text"/>
");
0

Source: https://habr.com/ru/post/1697740/


All Articles