# Array/Combo Box Help

**URL:** <https://forum.kirupa.com/t/array-combo-box-help/212287>\
**Category:** flash\
**Created:** [January 9, 2007, 11:08pm UTC](https://forum.kirupa.com/t/array-combo-box-help/212287 "2007-01-09T23:08:51Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![hpaum99](https://avatars.discourse-cdn.com/v4/letter/h/e8c25b/32.png) [@hpaum99](https://forum.kirupa.com/u/hpaum99)\
**Post date:** [January 9, 2007, 11:08pm UTC](https://forum.kirupa.com/t/array-combo-box-help/212287/1 "2007-01-09T23:08:51Z")

</div>

I am fixing a bug on an app that someone else developed but there is a huge bug in it. There is a combo box that is being auto populated with the school year.  
So it looks like this…  
2004-2005  
2005-2006  
2006-2007  
2007-2008

The problem is that the default selection is the 2004-2005 school year when it should be 2006-2007

Here is the code:

//Setup Year combo box  
var myArray:Array = new Array();  
var intCurrentYear:Number = 0;  
var myDate:Date = new Date();  
for (i=2004; i\<=myDate.getFullYear(); i++) {  
myArray.addItem({label:i+" - "+(i+1), data:i});  
if ((i == myDate.getFullYear()) && (myDate.getMonth()\>=5)) {  
intCurrentYear = i-2004;

```
		}
	}
	
trace("current year1:" + intCurrentYear);
trace("i=" + i);
Competencies.cboSchoolYear.dataProvider = myArray;
Competencies.cboSchoolYear.selectedIndex = intCurrentYear;

```

The variable “i” should equal 2006 and the variable intCurrent year should equal 2

I didn’t write any of this code and i’m going crazy trying to figure out how to fix it.

Please help!!

Thanks
