# If statement and components

**URL:** <https://forum.kirupa.com/t/if-statement-and-components/229986>\
**Category:** flash\
**Created:** [June 21, 2007, 8:20pm UTC](https://forum.kirupa.com/t/if-statement-and-components/229986 "2007-06-21T20:20:31Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Multi\_Task](https://avatars.discourse-cdn.com/v4/letter/m/c6cbf5/32.png) [@Multi\_Task](https://forum.kirupa.com/u/Multi_Task)\
**Post date:** [June 21, 2007, 8:20pm UTC](https://forum.kirupa.com/t/if-statement-and-components/229986/1 "2007-06-21T20:20:31Z")

</div>

Hey yall trying to use a datalist and button from components library. on the datalist I am attempting at using arrays and have found it to be wrong when i am checking if something from the datalist is not selected set focus to it. code below

```auto

var arUrl:Array=["/hido/browsecategory.aspx?cat=6","/hido/browsecategory.aspx?cat=7"," ect....."];
var provider:Array=[{label:"User1",data:0},{label:"User2",data:1}, "ect..."];
choice.mcList.dataProvider=provider;
var obj:Object={};
obj.click=function(eo:Object) {
var count:Number=choice.mcList.selectedItem.data;
getURL(arUrl[count],"_self");
 if (arUrl[count] == 0-1) {
  setFocus.choice.mcList;
}
trace("count="+arUrl[count]);
}

```

The thing works great before I attempeted at putting a catch on it. Now I want to add the feature to check to see if datalist is has been selected then on button press if it hasnt setFocus to it. What am I doing wrong here? Thanks in advance
