R – Flex 3 focusManager.getNextFocusManagerComponent() returns null

actionscript-3airapache-flexflex3

I have an app where I am looking to make the enter key act like a tab key. I can easily capture the keypress event and setFocus to a textinput field. The problem is figuring out which textinput field to give focus to. I have this code


trace(this.window.focusManager);
//returns TheWindow86.focusManager

trace(this.window.focusManager.getNextFocusManagerComponent());
//returns null

//This is what I was hoping would work
this.window.focusManager.getNextFocusManagerComponent().setFocus();

The code is in a controller class and "this.window" references an instance of a nativeWindow mxml file "TheWindow.mxml". The first trace works as expected, but the second one gives null. The last line is the code that I am wanting to work.

Best Answer

focusManager.moveFocus(FocusRequestDirection.FORWARD);

try it;

Related Topic