ActionScript 2.0 Components Language Reference |
|
|
|
| Slide class > Slide.defaultKeydownHandler | |||
Flash Player 6 (6.0.79.0).
Flash MX Professional 2004.
mySlide.defaultKeyDownHandler = function (eventObj) { // Your code here. }
eventObj An event object with the following properties:
type A string indicating the type of event. Possible values are "keyUp" and "keyDown".ascii An integer that represents the ASCII value of the last key pressed; corresponds to the value returned by Key.getAscii().code An integer that represents the key code of the last key pressed; corresponds to the value returned by Key.getCode().shiftKey A Boolean value indicating if the Shift key is currently being pressed (true) or not (false).ctrlKey A Boolean value indicating if the Control key is currently being pressed (true) or not (false).Nothing.
Callback function; lets you override the default keyboard navigation with a custom keyboard handler that you create. For example, instead of having the Left and Right Arrow keys navigate to the previous and next slides in a presentation, respectively, you could have the Up and Down Arrow keys perform those functions. For a discussion of the default keyboard handling behavior, see Slide.autoKeyNav.
In that example, the default keyboard handling is altered for child slides of the slide to which the on(load) handler is attached. This handler uses the Up and Down Arrow keys for navigation instead of the Left and Right Arrow keys.
on (load) {
this.defaultKeyDownHandler = function(eventObj:Object) {
switch (eventObj.code) {
case Key.DOWN :
this.currentSlide.gotoNextSlide();
break;
case Key.UP :
this.currentSlide.gotoPreviousSlide();
break;
default :
break;
}
};
}
|
|
|
|