Example
The following example defines a function for the
action to the Output panel:
my_mc.onKeyUp = function () {
trace ("onKey called");
}
The following example sets input focus:
my_mc.focusEnabled = true;
Selection.setFocus(my_mc);
See also
getAscii (Key.getAscii method)
(Key.onKeyDown event listener)
,
property)
onKeyDown (MovieClip.onKeyDown handler)
(Selection.setFocus method)
onKillFocus (MovieClip.onKillFocus handler)
onKillFocus = function(newFocus:Object) {}
Invoked when a movie clip loses keyboard focus. The
parameter,
newFocus
no object receives the focus,
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.
Availability: ActionScript 1.0; Flash Player 6
Parameters
- The object that is receiving the keyboard focus.
newFocus:Object
Example
The following example reports information about the movie clip that loses focus, and the
instance that currently has focus. Two movie clips, called
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);
};
,
getCode (Key.getCode method)
,
focusEnabled (MovieClip.focusEnabled
, which is an object that represents the new object receiving the focus. If
contains the value
newFocus
method that sends a
onKeyUp
,
setFocus
method receives one
onKillFocus
.
null
and
my_mc
other_mc
trace()
,
onKeyDown
, are on the
MovieClip
905
Need help?
Do you have a question about the FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE and is the answer not in the manual?