# Problems with Selection.setFocus

**URL:** <https://forum.kirupa.com/t/problems-with-selection-setfocus/201791>\
**Category:** flash\
**Created:** [September 25, 2006, 8:17am UTC](https://forum.kirupa.com/t/problems-with-selection-setfocus/201791 "2006-09-25T08:17:07Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![gfang](https://avatars.discourse-cdn.com/v4/letter/g/e19b73/32.png) [@gfang](https://forum.kirupa.com/u/gfang)\
**Post date:** [September 25, 2006, 8:17am UTC](https://forum.kirupa.com/t/problems-with-selection-setfocus/201791/1 "2006-09-25T08:17:07Z")

</div>

I am working on a Flash form with this action script in the first frame.

```
var holder=_root.createEmptyMovieClip("holder_mc",500);    
var myAreaVar=holder.createClassObject(mx.controls.TextArea,"myArea",1);
myAreaVar.text="fooooooo";   

```

Why is it that I have to place the below code in a second keyframe for it to work?

```
     Selection.setFocus(holder_mc.myArea);

```

If I place it in the starting keyframe with the rest of the script it does not work.  
I can work with this but I would really like to understand why this happens and  
if there is a way to get it to work in a movie where there is only one frame.
