views:

1720

answers:

3

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

Thanks.

A: 

You can set the enabled property to "false" which disables user interaction. You may want to also change the disabledcolor property to your choice.

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

You could 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." />
onekidney
A: 

You can disable paste of more than 1 character by trapping the textInput event:


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

bugmenot