TextField.onKillFocus
737
A reference to the text field instance is passed as a parameter to the
onChanged
handler. You can
capture this data by putting a parameter in the event handler method. For example, the following
code uses
textfield_txt
as the parameter that is passed to the
onChanged
event handler. The
parameter is then used in a
trace()
method to write the instance name of the text field to the log
file:
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
onChanged
handler is fired only when the change results from user interaction; for 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
onChanged
event because the code recognizes changes that are made to the text field.
TextField.onKillFocus
Availability
Flash Player 6.
Usage
my_txt
.onKillFocus = function(
newFocus:Object
){
// your statements here
}
Parameters
newFocus
The object that is receiving the focus.
Returns
Nothing.
Description
Event handler; invoked when a text field loses keyboard focus. The
onKillFocus
method receives
one parameter,
newFocus
, which is an object representing the new object receiving the focus. If
no object receives the focus,
newFocus
contains the value
null
.
Example
The following example creates two text fields called
first_txt
and
second_txt
. When you give
focus to a text field, information about the text field with current focus and the text field that lost
focus writes to the log file.
this.createTextField("first_txt", 1, 10, 10, 300, 20);
first_txt.border = true;
first_txt.type = "input";
this.createTextField("second_txt", 2, 10, 40, 300, 20);
Содержание FLEX-FLEX ACTIONSCRIPT LANGUAGE
Страница 1: ...Flex ActionScript Language Reference...
Страница 8: ......
Страница 66: ...66 Chapter 2 Creating Custom Classes with ActionScript 2 0...
Страница 76: ......
Страница 133: ...break 133 See also for for in do while while switch case continue throw try catch finally...
Страница 135: ...case 135 See also break default strict equality switch...
Страница 146: ...146 Chapter 5 ActionScript Core Language Elements See also break continue while...
Страница 229: ...while 229 i 3 The following result is written to the log file 0 3 6 9 12 15 18 See also do while continue for for in...
Страница 808: ...808 Chapter 7 ActionScript for Flash...
Страница 810: ...810 Appendix A Deprecated Flash 4 operators...
Страница 815: ...Other keys 815 Num Lock 144 186 187 _ 189 191 192 219 220 221 222 Key Key code...
Страница 816: ...816 Appendix B Keyboard Keys and Key Code Values...
Страница 822: ...822 Index...