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.
精彩评论