There was a comment by Muaad for help on how to capture Keyboard Events in AS 3.0. I figured instead of filling up a comment box I’d just go ahead and do a little post on it.
Keyboard Events and capturing them has been around for a long time. I’m going to assume Flash 4 days since I’d built a little animated typer in Flash 4 and can’t recall doing it Flash 3.
Like everything else in AS 3.0, you need to import the appropriate class(es);
For capturing Keyboard Events, you’ll need;
import flash.events.KeyboardEvent;
Add an eventListener to the stage for whatever you want to capture KEY_DOWN, KEY_UP, etc etc.
stage.addEventListener(KeyboardEvent.KEY_DOWN,checkKey);
There you go, Muaad.


Post a Comment