topical media & game development
actionscript-events-GlobalKeyboardSensor.ax
actionscript-events-GlobalKeyboardSensor.ax
[swf]
flex
package {
import flash.display.*;
import flash.events.*;
// Demonstrates how to handle keyboard events from a global
// point of reference. Displays a debugging message when a key is pressed
// while Flash Player has system focus.
public class @ax-actionscript-events-GlobalKeyboardSensor extends Sprite {
public function @ax-actionscript-events-GlobalKeyboardSensor () {
stage.addEventListener(KeyboardEvent.KEY_DOWN, keyDownListener);
}
private function keyDownListener (e:KeyboardEvent):void {
trace("A key was pressed.");
}
}
}
(C) Æliens
27/08/2009
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.