We help IT Professionals succeed at work.

TextFields and Enter/Return key

Last Modified: 2013-11-11
How can I make the Enter key act like the Tab key for single-line input TextFields ?

I am writing an application in Actionscript3 (Flash). In the application I have a number of single-line text fields (user name, password, description etc). Some pages just have one such field, some have three or four.

My client wants the users to able to finish text entry in one (single-line) field and move to the next field by pressing the Enter key, just like Tab.

At present, pressing the Enter key while a single-line textfield has focus, does nothing. As far as I can tell, the Enter key does not create a TEXT_INPUT event (and neither does the Tab key).

However if I change the textfield to multiline, and then prevent the default action, I can at least catch the Enter key. Then the problem comes how to move the focus to the next field. (I was hoping to avoid the FocusManager). But is that the best way to go ?

What I really want to do is just turn an Enter keypress into a Tab key in some circumstances.  

As ever, I cant help feeling that this must be a very common requirement and that there must be a well-known solution.

Any help much appreciated.
Watch Question

Principal Software Engineer
This one is on us!
(Get your first solution completely free - no credit card required)


Thanks for response, devarioj.

That is my problem exactly, though that solution isn't Actionscript3.

But I guess the idea of checking which textfield has the focus, on every enter keydown, and then moving the focus to another field is the basis of a solution. It seems a lot of hardwork though, esp as you have to handcode the(automatic)  tab order etc.

Thanks anyway.
I'll see if I can make that work in Actionscript3.


Thanks for your help, devarioj.
I'll have to modify this somewhat for AS3, but you have given me the direction to proceed in.
Many thanks.
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.