This content has been marked as final. Show 4 replies
Enable the enter key?
If you want enter to automatically submit a button, look up the defaultButton? Is that what you mean?
An easy way to enable the enter key for all buttons (when they have the focus)
- on each button add a click event handler that does what the button needs to do
- Just add a keyDown Handler to the component that contains the buttons
- In the key down handler check for the enter key, and if the target is a button.
If so then dispatch a button click event.
In the code below if the user tabs to a button and presses enter
the button will be clicked.
private function handleKeyDown(event:KeyboardEvent):void
var char:uint = event.keyCode;
var enterChar:uint = 13;
var tabChar:uint = 9;
var pgUp:uint = 33;
var pgDown:uint = 34;
if(char == enterChar)
if(event.target is Button)
var bt:Button = event.target as Button;
if(bt.enabled == false || bt.visible == false)
var c:MouseEvent = new MouseEvent(MouseEvent.CLICK,true);
No i want to enable the enter key in flex , I put some validation on text box . I trying to call them on enter pressing in textbox