break;
case Key.RIGHT :
car_mc._x += DISTANCE;
break;
case Key.DOWN :
car_mc._y += DISTANCE;
break;
}
};
Key.addListener(keyListener_obj);
Key.onKeyDown
Availability
Flash Player 6.
Usage
keyListener.onKeyDown
Description
Listener; notified when a key is pressed. To use
can then define a function for
Key object, as shown in the following example:
var keyListener:Object = new Object();
keyListener.onKeyDown = function() {
trace("DOWN -> Code: "+Key.getCode()+"\tACSII: "+Key.getAscii()+"\tKey:
"+chr(Key.getAscii()));
};
keyListener.onKeyUp = function() {
trace("UP -> Code: "+Key.getCode()+"\tACSII: "+Key.getAscii()+"\tKey:
"+chr(Key.getAscii()));
};
Key.addListener(keyListener);
Listeners enable different pieces of code to cooperate because multiple listeners can receive
notification about a single event.
See also
Key.addListener()
Key.onKeyUp
Availability
Flash Player 6.
Usage
keyListener.onKeyUp
308
Chapter 6: ActionScript Core Classes
onKeyDown,
and use
onKeyDown
addListener()
you must create a listener object. You
to register the listener with the
Need help?
Do you have a question about the FLEX-FLEX ACTIONSCRIPT LANGUAGE and is the answer not in the manual?