# Remove textField Focus

**URL:** <https://forum.kirupa.com/t/remove-textfield-focus/245739>\
**Category:** flash\
**Created:** [December 3, 2007, 4:41pm UTC](https://forum.kirupa.com/t/remove-textfield-focus/245739 "2007-12-03T16:41:29Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![bandit8](https://avatars.discourse-cdn.com/v4/letter/b/c6cbf5/32.png) [@bandit8](https://forum.kirupa.com/u/bandit8)\
**Post date:** [December 3, 2007, 4:41pm UTC](https://forum.kirupa.com/t/remove-textfield-focus/245739/1 "2007-12-03T16:41:29Z")

</div>

Hi,

I have a movie that has four different input text fields, all in separate movieClips. Inside each movie clip I have code that listens for the ‘Enter’ key to be pressed, and if it is, it stores the value and turns the focus off of that textField…which works great.

```auto
[LEFT]txt.onKeyDown = function(){
    if (Key.isDown(Key.ENTER) && eval(Selection.getFocus()) == this){
        slider_mc.gotoAndStop(1);
        Selection.setFocus(null);
    }
}[/LEFT]
 

```

My problem is that I want it so that if the focus is on one of the textFields, if they click anywhere outside any of the textFields, I want the cursor to disappear from the textField it was in, and all focus to be lost.

I tried doing this, by putting

```auto
  [LEFT]Selection.setFocus(null);[/LEFT]

```

on the root, but the cursor remains in the textField…which is weird since it worked in the onKeyDown function above.

Any ideas??

Thanks!  
-b.
