Skip to main content
Participant
January 13, 2010
Question

How to prevent TextArea control to get focus?

  • January 13, 2010
  • 1 reply
  • 728 views

Hi, I am working with the keyboard events and want to prevent the TextArea control to get focus when user uses mouse. I think I set all possible properties of the control, but nevertheless when I click the mouse over it, it gets the focus:

<mx:Script>

     <![CDATA[

     import flash.events.FocusEvent;

     public function onFocus(event:FocusEvent):void {

          trace ("I am in focus");

     }

     ]]>

</mx:Script>

<mx:TextArea id="xmlField" width="100%" height="50%"    
styleName="detailText" text="{PLEASE_WAIT}"
verticalScrollPolicy="auto" horizontalScrollPolicy="off"
buttonMode="false"
wordWrap="true"
mouseFocusEnabled="false" mouseEnabled="false"
tabEnabled="false" focusEnabled="false" focusIn="onFocus(event);"
selectable="false" editable="false"/>

I use Flex SDK 3.3 and Adobe AIR 1.5.

Thanks,

Elena

This topic has been closed for replies.

1 reply

Participant
February 22, 2010

Not sure why the component gets the focus. I've tried your example in both Air and Flash Player applications and in both cases I have't received any

focus events. Although you could try to set mouseChildrenEnabled="false" and tabChildrenEnabled="false" but I'm not sure if this will help.

Maybe it's because of the SDK version. I used 3.4 so you might also want to update your SDK and see if that helps.