In a loop, set color of stage instances

Hi,

I’m reading an XML file, receiving the hex value, then setting the color of an object on the stage using Tweener. There are 88 objects (keys on a keyboard).

Here’s the code I’m using:

function ParseColors(bookInput:XML):void {
  var i:Number = 1
 
  while (i < 88) {
 
  var k = (bookInput.key.k.text()*); //this is the number of the key
  var khex= (bookInput.key.hex.blank.text()*);
 
  var theKey = "k"+i;
 
  trace(theKey);
  trace(khex);
 
  Tweener.addTween(theKey, {_color:khex, time:2});
 
  i++;
 
  }
 
 }

The traces show everything correctly, but Tweener throws errors when it tries to set each key to it’s corresponding colors.

The keys are on the stage with instance names k1,k2,k3,k4, etc.

I think I’m missing something silly, can anyone help out?