1 Reply Latest reply on Jan 9, 2007 9:42 PM by arunbe

    Combo box/Array Help

    hpaum99
      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