简体   繁体   中英

Flex: Multiple TextInput focus issue

The issue that I've been confronted with for some time now is that a TextInput never loses focus.

I tried to solve this issue by putting stage.focus=null on the click event of the Application . However, this prevents the TextInput from ever getting the focus. This can be solved by having stopPropagation on the TextInput . This may be a solution.

What I want to achieve is to have the TextInput lose focus on click outside, on another TextInput or any other element.

Can you recommend another way to do it?

Try this,

textInput.addEventListener(FlexMouseEvent.MOUSE_DOWN_OUTSIDE, forceFocusOut);

private function forceFocusOut(e:Event):void{
   stage.focus = null;
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM