MACROMEDIA FLASH MX 2004 - ACTIONSCRIPT Reference Manual page 683

Actionscript reference guide
Hide thumbs Also See for FLASH MX 2004 - ACTIONSCRIPT:
Table of Contents

Advertisement

TextField.addListener()
Availability
Flash Player 6.
Usage
my_txt.addListener(listener)
Parameters
An object with an
listener
Returns
Nothing.
Description
Method; registers an object to receive notification when the
handlers have been invoked. When a text field changes or is scrolled, the
and
TextField.onScroller
event handlers of any objects registered as listeners. Multiple objects can be
onScroller
registered as listeners.
To remove a listener object from a text field, call
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 the event
handler method. For example, the following code uses
event handler. The parameter is then used in a
onScroller
name of the text field to the Output panel.
myTextField.onScroller = function (txt) {
trace (txt._name + " changed");
};
Example
The following example defines an
defines a new listener object,
This handler will be invoked when the text field
TextField.addListener
that it will be notified when
myText.onChanged = function (txt) {
trace(txt._name + " changed");
};
myListener = new Object();
myListener.onChanged = function (txt) {
trace(txt._name + " changed and notified myListener");
};
myText.addListener(myListener);
See also
TextField.onChanged
or
onChanged
onScroller
event handlers are invoked, followed by the
handler for the input text field
onChange
, and defines an
myListener
to register the listener object
changes.
myText
,
TextField.onScroller
event handler.
onChanged
TextField.removeListener()
onScroller
as the parameter that is passed to the
txt
statement to send the instance
trace
handler for that object.
onChanged
is changed. The final line of code calls
myText
with the text field
myListener
,
TextField.removeListener()
TextField.addListener()
and
event
onScroller
TextField.onChanged
and
onChanged
.
and
onChanged
. It then
myText
myText
683
so

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH MX 2004 - ACTIONSCRIPT and is the answer not in the manual?

Questions and answers

Table of Contents