My application has many data entry forms using a variety of textAreas, textFields, comboBoxes and buttons. Each form consists of a MovieClip with a number of related input fields added as children of that MovieClip. I want the user to be able to tab through the fields of each form. I also want to identify one of the buttons on each form as the “default button” which should dispatch a click event when the enter key is pressed.
For each entry object I have set tabEnabled = true and assigned a tabIndex value. Tabbing seems to work across textFields and textAreas, but gets “stuck” at comboBoxes and buttons. I thought that the tab order might be affected by the fact that comboBoxes and buttons have children, so I set tabChildren = false for comboBox and buttons.
I set up an eventListener for FocusEvent.KEY_FOCUS_CHANGE and had the listener function do this:
function focusHandler(e:FocusEvent):void {
var ob = e.relatedObject;
trace(ob.focusManager.getNextFocusManagerComponent());
}
The trace output shows the button or comboBox that is about to receive focus, but once the button or comboBox gets focus the eventListener no longer receives the KEY_FOCUS_CHANGE event.
I also tried creating a FocusManager object:
var fmUnit:FocusManager = new FocusManager(unitForm);
var btn = unitForm.getChildByName("submit");
fmUnit.defaultButton = btn;
This succeeds in setting the button as a default button, but still the tab progress gets stuck.
Any help would be apreciated.