When you test the document, the instance name and depth is displayed in the Output panel.
The
method used in this example requires Flash Player
MovieClip.getNextHighestDepth()
7 or later. If your SWF file includes a version 2 component, use the version 2 components
DepthManager class instead of the
method.
MovieClip.getNextHighestDepth()
onChanged (TextField.onChanged handler)
onChanged = function(changedField:TextField) {}
Event handler/listener; invoked when the content of a text field changes. By default, it is
undefined; you can define it in a script.
A reference to the text field instance is passed as a parameter to the
handler. You
onChanged
can capture this data by putting a parameter in the event handler method. For example, the
following code uses
as the parameter that is passed to the
event
textfield_txt
onChanged
handler. The parameter is then used in a
statement to send the instance name of the
trace()
text field to the Output panel:
this.createTextField("myInputText_txt", 99, 10, 10, 300, 20);
myInputText_txt.border = true;
myInputText_txt.type = "input";
myInputText_txt.onChanged = function(textfield_txt:TextField) {
trace("the value of "+textfield_txt._name+" was changed. New value is:
"+textfield_txt.text);
};
The
handler is called only when the change results from user interaction; for
onChanged
example, when the user is typing something on the keyboard, changing something in the text
field using the mouse, or selecting a menu item. Programmatic changes to the text field do not
trigger the
event because the code recognizes changes that are made to the text
onChanged
field.
Availability: ActionScript 1.0; Flash Player 6
Parameters
- The field triggering the event.
changedField:TextField
See also
,
TextFormat
setNewTextFormat (TextField.setNewTextFormat method)
TextField
1193
Need help?
Do you have a question about the FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE and is the answer not in the manual?