In an Earlier Post, I extended the TextInput to capture the enter key.

After being set straight by Alex H. and Graham on flexcoders, I see it may have been overkill. Instead of extending the control to capture the enter key, all that was needed was to use enter="somefunction()".

private function handleMoveNext(event:Event):void
{
var fm:IFocusManager = event.target.focusManager;
var next:IFocusManagerComponent =
fm.getNextFocusManagerComponent();
fm.setFocus(next);
}
<mx:TextInput id="firstBox"
tabIndex="0"
enter="handleMoveNext(event)"/>
<mx:TextInput id="secondBox"
tabIndex="1"
enter="handleMoveNext(event)"/>
I think the example is still valid to show how you can extend the control to capture input into the TextInput, but my usage did not require any extending of the control.

See for yourself:

ExtendingControls Demo
Put focus in one of the boxes; Hit the enter key; You will see the focus change; Try not to use the mouse (hard for me at first).

Not Extended Demo
Put focus in one of the boxes; Hit the enter key.


ExtendingControls Source

You can also right click and View Source.

Currently rated 2.4 by 5 people

  • Currently 2.4/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5