Onkeyup (Movieclip.onkeyup Handler) - MACROMEDIA FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE Reference

Actionscript 2.0 language reference
Table of Contents

Advertisement

Example
The following example defines a function for the
action to the Output panel. Create a movie clip called my_mc and add the following
ActionScript to your FLA or AS file:
my_mc.onKeyDown = function () {
trace ("key was pressed");
}
The movie clip must have focus for the
ActionScript to set input focus:
my_mc.tabEnabled = true;
my_mc.focusEnabled = true;
Selection.setFocus(my_mc);
When the user presses a key,
does not occur after you move the mouse, because the movie clip loses focus. Therefore, you
should use
Key.onKeyDown
See also
getAscii (Key.getAscii method)
(Key.onKeyDown event listener)
,
property)

onKeyUp (MovieClip.onKeyUp handler)

method)
onKeyUp (MovieClip.onKeyUp handler)
onKeyUp = function() {}
Invoked when a key is released. The
You can use the
Key.getAscii()
pressed. 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.
The
event handler works only if the movie clip has input focus enabled and set.
onKeyUp
First, the
MovieClip.focusEnabled
the movie clip must be given focus. You can do this by using
setting the Tab key to navigate to the movie clip.
If you use
Selection.setFocus()
Selection.setFocus()
user moves the mouse.
Availability: ActionScript 1.0; Flash Player 6
904
ActionScript classes
onKeyDown
key was pressed
in most cases.
,
getCode (Key.getCode method)
,
focusEnabled (MovieClip.focusEnabled
onKeyUp
and
Key.getCode()
property must be set to
, you must pass the path for the movie clip to
. It is very easy for other elements to take the focus back after the
method that sends a
onKeyDown()
event handler to work. Add the following
displays in the Output panel. However, this
,
setFocus (Selection.setFocus
event handler is invoked with no parameters.
methods to determine which key was
true
Selection.setFocus()
trace()
,
onKeyDown
for the movie clip. Then,
or by

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE and is the answer not in the manual?

Subscribe to Our Youtube Channel

This manual is also suitable for:

Flash 8

Table of Contents

Save PDF