MACROMEDIA FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE Reference page 1168

Actionscript 2.0 language reference
Table of Contents

Advertisement

A reference to the text field instance is passed as a parameter to the
handlers by the event source. You can capture this data by putting a parameter in
onChanged
the event handler method. For example, the following code uses
passed to the
onScroller
send the instance name of the text field to the Output panel.
my_txt.onScroller = function(textfield_txt:TextField) {
trace(textfield_txt._name+" scrolled");
};
Availability: ActionScript 1.0; Flash Player 6
Parameters
- An object with an
listener:Object
Returns
-
Boolean
Example
The following example defines an
defines a new listener object,
object. This handler will be invoked when the text field
code calls
TextField.addListener
field
so that it will be notified when
my_txt
this.createTextField("my_txt", this.getNextHighestDepth(), 10, 10, 100,
22);
my_txt.border = true;
my_txt.type = "input";
my_txt.onChanged = function(textfield_txt:TextField) {
trace(textfield_txt._name+" changed");
};
var txtListener:Object = new Object();
txtListener.onChanged = function(textfield_txt:TextField) {
trace(textfield_txt._name+" changed and notified myListener");
};
my_txt.addListener(txtListener);
The
MovieClip.getNextHighestDepth()
7 or later. If your SWF file includes a version 2 component, use the version 2 components
DepthManager class instead of the
1168
ActionScript classes
event handler. The parameter is then used in a
onChanged
handler for the input text field
onChanged
, and defines an
txtListener
to register the listener object
my_txt
method used in this example requires Flash Player
MovieClip.getNextHighestDepth()
onScroller
as the parameter that is
txt
or
event handler.
onScroller
handler for that
onChanged
is changed. The final line of
my_txt
txtListener
changes.
and
statement to
trace
. It then
my_txt
with the text
method.

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Flash 8

Table of Contents