Just say i have an application with two panels on it. Each panel has a form with textinputs. I also have in each panel a key listener so the user can press enter to move to the next text input in the form.
What is the best policy to manage these listeners should i
1) Have a key listener in the parent of the two panels and on key press call a function in the panel with focus to preform the action required
2) Have a listener in each panel and use some event like focusIn and focusOut to add / remove the listeners
3) Some other method that might exist
I'd create a Actionscript class that subclasses Form. In that subclass, add your event listener for the keyDown event and handle the Enter key. You can use the FocusManager.getNextFocusManagerComponent function to change focus in a generic way.
hey think im going to use the
on the root tag of the file and then override the keyUpHandler
override protected function keyUpHandler(event:KeyboardEvent):void
seams to work fine for my needs at the mo anyway
using the IFocusManagerComponent so far has not caused any problems , although i have not started to full implement my key listening functionality yet