# List component Help

**URL:** <https://forum.kirupa.com/t/list-component-help/222858>\
**Category:** flash\
**Created:** [April 17, 2007, 3:44pm UTC](https://forum.kirupa.com/t/list-component-help/222858 "2007-04-17T15:44:53Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ahref](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/ahref/32/3309_2.png) [@ahref](https://forum.kirupa.com/u/ahref)\
**Post date:** [April 17, 2007, 3:44pm UTC](https://forum.kirupa.com/t/list-component-help/222858/1 "2007-04-17T15:44:53Z")

</div>

Hi,

Im using the List component as a menu. The user uses the arrow keys to go up and down the items in the component and uses another key to select them. This is all working but now i would like to include infinite menus. I have made a quick animation to show you what i mean:  
[http://ahref.theicy.net/i/infm.swf](http://ahref.theicy.net/i/infm.swf)

im currently using this code:

```auto

focusManager.setFocus(_root.menu);
lastItem = menu.length - 1;
menu.selectedIndex = 0;
var keyListener:Object = new Object();
keyListener.onKeyDown = function() {
if((menu.selectedIndex == lastItem)&&(Key.getCode() == 40)){
	
	menu.selectedIndex = 0;
}
if((menu.selectedIndex == 0)&&(Key.getCode() == 38)){
	
	menu.selectedIndex = lastItem;
}

```

however this results in an “off by one error” and the top item and botom item cant be selected. eg.  
[http://ahref.theicy.net/i/offbyone.swf](http://ahref.theicy.net/i/offbyone.swf)

does anyone know how i can fix this?

if you dont understand please ask ill try and explain more:)

thanks
