Posted By

visualadvance on 03/07/10


Tagged

focus stage keyboardevent


Versions (?)

Who likes this?

3 people have marked this snippet as a favorite

TrentSkunk
tspitzr
adrianparr


AS3: Stage Keeping Focus for KeyboardEvent


 / Published in: ActionScript 3
 

This is extremely helpful if your key events keep losing focus (from someone clicking somewhere else). Make the events get focus again do this.

  1. stage.addEventListener (KeyboardEvent.KEY_DOWN, keyDownHandler, false);
  2.  
  3. stage.focus = stage;

Report this snippet  

You need to login to post a comment.