scott
scott

Reputation: 1

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

Every time a user takes a new line (i.e each time they press the return/enter key) 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

Upvotes: 0

Views: 734

Answers (2)

jeremy.mooer
jeremy.mooer

Reputation: 645

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.

Upvotes: 1

JeffryHouser
JeffryHouser

Reputation: 39408

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

Upvotes: 1

Related Questions