开发者

Cancel text selection on textinput in Flex

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 htt开发者_StackOverflowp://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.


try add a listener event MouseEvent.MOUSE_OVER, 
event.buttonDown is false then 
TextInput(event.target).setSelection(0,0);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜