MovieClip.onKeyDown
Availability
Flash Player 6.
Usage
my_mc.onKeyDown = function() {
// your statements here
}
Parameters
None.
Returns
Nothing.
Description
Event handler; invoked when a movie clip has input focus and a key is pressed. The
event handler is invoked with no parameters. You can use the
Key.getCode()
executes when the event handler is invoked.
The
onKeyDown
the
focusEnabled
focus. This can be done either by using
navigate to the clip.
If
Selection.setFocus()
Selection.setFocus()
is moved.
Example
The following example defines a function for the
action to the Output panel.
my_mc.onKeyDown = function () {
trace ("onKeyDown called");
};
The following example sets input focus.
MovieClip.focusEnabled = true;
Selection.setFocus(MovieClip);
See also
MovieClip.onKeyUp
methods to determine which key was pressed. You must define a function that
event handler works only if the movie clip has input focus enabled and set. First,
property must be set to
is used, the path for the movie clip must be passed to
. It is very easy for other elements to take the focus back once the mouse
for the movie clip. Then, the clip must be given
true
Selection.setFocus()
onKeyDown()
and
Key.getAscii()
or by setting the tab key to
method that sends a
MovieClip.onKeyDown
onKeyDown
trace()
521
Need help?
Do you have a question about the FLASH MX 2004 - ACTIONSCRIPT and is the answer not in the manual?