KeyManager revisted for Flex and AS3 Projects
Posted by: Keith H in ActionScript 3, Adobe AIR, Flash 9, Flash Builder, Flex, tags: Game Logic, Gatekeeper, Ghostbusters, Gozer, key codes, KeyboardEvent, KeyManager, Keymaster, Keys, Preventing Sticky Keys, State, Zuul
Dana Barrett: Are you the Keymaster?
Dr. Peter Venkman: Yes. Actually I'm a friend of his, he asked me to meet him here.
-Ghostbusters
It's been a whole year since I needed to use the KeyManager class and from comments I've been made aware of bugs in my script.
I was hoping the scripts would be a sufficient start that should issues arrive, others would come up with work-a-rounds. (Thank you to all who noted solutions and problems.)
Lately I was needing to write some keyboard interactivity again and I wanted to add some features to help simplify newer task...also fix a couple of things in the process.
In Flex, a lot of coding deals with listening to events. The KeyManager needed events for the tasks I was working on. Callback functions where ok at first but adding "KEY_DOWN", "KEY_UP" and "KEY_SEQUENCE" events help make the class more useful for monitoring status. Monitoring events give more options for handling keyboard activity in one handler function versus using a separate function for each keyboard combination. So now I've updated the class to have both.
Read the rest of this entry »

Entries (RSS)