
TextField.onChanged() Event Handler and Listener Event
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
852
|
ActionScript Language Reference
TextField.onChanged() Event Handler and Listener Event
invoked when user input is detected
Flash 6
theField.onChanged(changedField)
listener.onChanged(changedField)
Arguments
changedField The TextField object for which input was detected.
Description
The onChanged() event is triggered whenever the user enters or deletes text in theField.
Typically, onChanged() is used to trigger input-validation routines in response to the user’s
entries while the user is still typing. Possible uses include an inline spellchecker, an email
validator, or an autocomplete feature for a text field.
Note that onChanged() is not triggered when new text is assigned to
theField through
ActionScript. For example, this statement does not trigger onChanged():
theField_txt.text = "Some new text...";
If theField.restrict is true and the user attempts to enter a restricted character, then the
keystroke is ignored and onChanged() is not triggered.
The onChanged() event can be handled with a callback function attached to the text field.
The following code registers a callback function that responds to onChanged():
// Create a text field that accepts user input
this.createTextField("theField_txt", 1, 0, 0, 200, 20);
theField_txt.type = ...