User Guide
558 Chapter 2: ActionScript Language Reference
MovieClip.onKillFocus
Availability
Flash Player 6.
Usage
my_mc.onKillFocus = function (newFocus:Object) {
// your statements here
}
Parameters
newFocus
The object that is receiving the keyboard focus.
Returns
Nothing.
Description
Event handler; invoked when a movie clip loses keyboard focus. The onKillFocus method
receives one parameter,
newFocus, which is an object that represents the new object receiving the
focus. If no object receives the focus,
newFocus contains the value null.
You must define a function that executes when the event handler is invoked. You can define the
function on the Timeline or in a class file that extends the MovieClip class or is linked to a symbol
in the library. For more information, see “Assigning a class to a movie clip symbol” in Using
ActionScript in Flash.
Example
The following example displays writes information about the movie clip that loses focus, and the
instance that currently has focus. Two movie clips, called
my_mc and other_mc, are on the Stage.
Add the following ActionScript to your AS or FLA document:
my_mc.onRelease = Void;
other_mc.onRelease = Void;
my_mc.onKillFocus = function(newFocus) {
trace("onKillFocus called, new focus is: "+newFocus);
};
Tab between the two instances, and information displays in the Output panel.
See Also
MovieClip.onSetFocus