Should I use the change or textInput event to capture user input on a TextInput control? Why?
Should I use the change or textInput event to capture user input on a
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
textInputis dispatched only when the user has input text into the control.change, on the other hand, is dispatched on every change committed by the user. So for example, if the user deletes a part of the text, only thechangeevent is dispatched.Neither of these is dispatched when the text is modified via code:
flash.events.TextEvent.TEXT_INPUT:(ignore the word ‘delete’ there — I just tried it and this event is not dispatched when text is deleted by the user)
flash.events.Event.CHANGE:You can also use the
valueCommitevent, which is dispatched when the user ‘commits’ the changes (usually by moving the focus away from the text field), but remember that this event is also dispatched when the field value is changed programmatically.