# Set Focus

**URL:** <https://forum.kirupa.com/t/set-focus/80236>\
**Category:** Uncategorized\
**Created:** [February 20, 2005, 8:59pm UTC](https://forum.kirupa.com/t/set-focus/80236 "2005-02-20T20:59:29Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pat\_Begg](https://avatars.discourse-cdn.com/v4/letter/p/df788c/32.png) [@Pat\_Begg](https://forum.kirupa.com/u/Pat_Begg)\
**Post date:** [February 20, 2005, 8:59pm UTC](https://forum.kirupa.com/t/set-focus/80236/1 "2005-02-20T20:59:29Z")

</div>

Hi all,  
I have a small problem with setting the focus of text fields in a form. I have the following code on the \_root timeline:

stop();  
Selection.setFocus(\_root.form.first\_name);  
myListener = new Object();  
myListener.onKeyDown = function() {  
if (Key.isDown(Key.TAB)) {  
Selection.setFocus(\_root.form.last\_name);  
}  
};

The text fields are held in a movie clip called ‘form’. It sets the focus to ‘first\_name’ but will not then focus on ‘last\_name’ when I hit TAB.  
I have about 5 text fields to go through.

Any ideas why it won’t focus?

Cheers guys,  
Pat
