Cancel text selection on textinput in Flex

Posted by Michael on Stack Overflow See other posts from Stack Overflow or by Michael
Published on 2010-06-09T22:17:06Z Indexed on 2010/06/10 8:02 UTC
Read the original article Hit count: 165

Filed under:

So the real problem is the lack of an onReleaseOutside function. I found some examples of how to bypass this during a drag function but it was not applicable for a text input.

The problem is that when a user selects some text in textinput and mouses off the application area and then mouses up, I'm getting a problem that the textinput keeps thinking that the mouse down is actively selecting text in the textinput and continually overwrites the characters being entered in the textinput.

You can test this at http://palermo.infusedindustries.com [ in the search bar of the live store on the page, type some text, then highlight it all and don't let up on the mouse until you are outside the store.

I finally hacked some junk together so I can tell if the mouse goes off the stage using some code like

var x = stage.mouseX;
var y = stage.mouseY;
if(x < 0 || y <0 || x >stage.stageWidth || y > stage.stageHeight)

I'd like to just make the textinput stop thinking it should be highlighting text so that even if the user scrolls out of the applet and mouses up that the text input still overwrites what is in the search bar and functions as normal.

I can't seem to find any events or ways to tell the Flex text field to stop thinking that the mouse is down and that the user is done selecting text.

© Stack Overflow or respective owner

Related posts about flex