开发者

FLEX - make textArea dispatch an event each time a new line is taken?

开发者 https://www.devze.com 2023-01-23 03:20 出处:网络
Every time a user takes a new line (i.e each time they press the return/enter key) 开发者_StackOverflow社区when typing in a textArea, I would like the textArea to dispatch an event.I can then listen f

Every time a user takes a new line (i.e each time they press the return/enter key) 开发者_StackOverflow社区when typing in a textArea, I would like the textArea to dispatch an event.I can then listen for this event and then carry out some processing on the textArea's contents.

Can anyone demo/advise how I can achieve this?

Thanks


Listen for the keyUp Event an check to see if the key pressed is enter.


Re el houser's answer: when dealing with components that have a UITextFields (TextInput, TextArea, etc.), you should try to use the keyDown event. If a user holds down a key on the keyboard in a TextInput component the keyDown event will be fired multiple times before a single keyUp event is fired.

There is a built-in event you can listen for -- FlexEvent.ENTER is already dispatched from UITextField (i believe). That should get you on the right path.

0

精彩评论

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