topical media & game development

talk show tell print

animation-ch02-KeyboardEvents.ax

animation-ch02-KeyboardEvents.ax [swf] [flash] flex


  package {
   import flash.display.Sprite;
   import flash.events.KeyboardEvent;
   
   public class @ax-animation-ch02-KeyboardEvents extends Sprite {
    public function @ax-animation-ch02-KeyboardEvents() {
     init();
    }
  

init(s)


    private function init():void {
     stage.addEventListener(KeyboardEvent.KEY_DOWN, onKeyboardEvent);
     stage.addEventListener(KeyboardEvent.KEY_UP, onKeyboardEvent);
    }
  

keyboard(s)


    public function onKeyboardEvent(event:KeyboardEvent):void {
     trace(event.type);
    }
   }
  }
  


(C) Æliens 04/09/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.