# Simple loop/colorTransform question

**URL:** <https://forum.kirupa.com/t/simple-loop-colortransform-question/305670>\
**Category:** flash\
**Created:** [March 1, 2010, 6:42pm UTC](https://forum.kirupa.com/t/simple-loop-colortransform-question/305670 "2010-03-01T18:42:12Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Reean917](https://avatars.discourse-cdn.com/v4/letter/r/a698b9/32.png) [@Reean917](https://forum.kirupa.com/u/Reean917)\
**Post date:** [March 1, 2010, 6:42pm UTC](https://forum.kirupa.com/t/simple-loop-colortransform-question/305670/1 "2010-03-01T18:42:12Z")

</div>

Hi All,

Simple question here. This function works fine up until it hits the else statement. As soon as I uncomment the line to set the mc’s to blue after the else it errors out. The gray works fine as long as the else is commented out. What gives?

```auto
function colorStates():void {
 for (var i:Number = 0; i<myArray.length; i++) {
  if (myArray*[2] == "NA") {
   trace("Gray States");
   a.color = (0x999999);
   this[myArray*[1]].transform.colorTransform = a;
  } else {
   trace("Blue States");
   a.color = (0x0062bb);
   //this[myArray*[1]].transform.colorTransform = a;
  }
 }
}

```
