# TAB, focus problem. HELP!

**URL:** <https://forum.kirupa.com/t/tab-focus-problem-help/280349>\
**Category:** Uncategorized\
**Created:** [January 26, 2009, 4:52pm UTC](https://forum.kirupa.com/t/tab-focus-problem-help/280349 "2009-01-26T16:52:21Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![OlaB](https://avatars.discourse-cdn.com/v4/letter/o/d07c76/32.png) [@OlaB](https://forum.kirupa.com/u/OlaB)\
**Post date:** [January 26, 2009, 4:52pm UTC](https://forum.kirupa.com/t/tab-focus-problem-help/280349/1 "2009-01-26T16:52:21Z")

</div>

[FONT=Arial]Hi![/FONT]  
[FONT=Arial]I am trying to create menu for my application. To select the correct button user has to first, use “TAB” key and, them press “ENTER”. I have a problem with setting up focus, so when movie is playing default focus is on my first button.[/FONT]  
[FONT=Arial]Please help![/FONT]  
[FONT=Arial] [/FONT]  
[FONT=Arial]

```auto
 
[FONT=Arial]stage.addEventListener(Event.ENTER_FRAME, main)[/FONT]
[FONT=Arial]var btn:Btn [/FONT]
[FONT=Arial]//var fm:FocusManager[/FONT]
[FONT=Arial] [/FONT]
[FONT=Arial]function main (e:Event)[/FONT]
[FONT=Arial]{ [/FONT]
[FONT=Arial] [/FONT]
[FONT=Arial]for(var i:Number=0; i<3; i++)[/FONT]
[FONT=Arial]{[/FONT]
[FONT=Arial] //fm= new FocusManager(this)[/FONT]
[FONT=Arial] btn=new Btn();[/FONT]
[FONT=Arial] btn.x=100+(50+ btn.width)* i[/FONT]
[FONT=Arial] btn.y=350[/FONT]
[FONT=Arial] btn.name=""+i[/FONT]
[FONT=Arial] btn.tabEnabled = true;[/FONT]
[FONT=Arial] [/FONT]
[FONT=Arial] btn.addEventListener(FocusEvent.FOCUS_IN, focusChange);[/FONT]
[FONT=Arial] [/FONT]
[FONT=Arial] var nextComponent:InteractiveObject[/FONT]
[FONT=Arial] //setFocus(nextComponent);[/FONT]
[FONT=Arial] addChild(btn);[/FONT]
[FONT=Arial]}[/FONT]
[FONT=Arial]stage.addEventListener(KeyboardEvent.KEY_UP, keyboardTest)[/FONT]
[FONT=Arial] [/FONT]
[FONT=Arial]}[/FONT]
[FONT=Arial] [/FONT]
[FONT=Arial] [/FONT]
[FONT=Arial]function keyboardTest(e:KeyboardEvent)[/FONT]
[FONT=Arial]{[/FONT]
[FONT=Arial]if(Keyboard.TAB)[/FONT]
[FONT=Arial] [/FONT]
[FONT=Arial] trace("tab") [/FONT]
[FONT=Arial]}[/FONT]
[FONT=Arial] [/FONT]
[FONT=Arial]function focusChange (e:FocusEvent):void[/FONT]
[FONT=Arial] [/FONT]
[FONT=Arial]{ [/FONT]
[FONT=Arial] trace(e.target) [/FONT]
[FONT=Arial]}[/FONT]
[FONT=Arial] [/FONT]

```

[/FONT][FONT=Arial][SIZE=3] [/SIZE][/FONT]
