I have an array of rectangular Sprites and ann array of Text Fields. On a certain condition, I want to change the fill colour of some of these Sprites and make the TextFields inside these Sprites editable. I tried the following:
var outerBox_Arr:Array = new Array();
for(var j:int=0; j<8;j++)
{
for(var i:int=0; i<8; i++)
{
var outerBox:Sprite = new Sprite();
outerBox.graphics.lineStyle(2, 0X018998);
outerBox.graphics.beginFill(0XE6FBFF);
outerBox.graphics.drawRect(sheet.x + 15 + 60i, sheet.y + 15 + 37j, 60, 37);
outerBox.graphics.endFill();
addChild(outerBox);
outerBox_Arr.push(outerBox);
var box:TextField = new TextField();
box.width = 60;
box.height = 37;
box.x = sheet.x + 15 + box.widthi;
box.y = sheet.y + 15 + box.heightj + 5;
box.defaultTextFormat = fmt;
addChild(box);
arrayOfBoxes.push(box);
}
}
for(i=0; i<2; i++)
{
for(j=1; j<=noOfDigits3; j++)
{
outerBox.graphics.beginFill(0XB0E3F9);
outerBox.graphics.drawRect(arrayOfBoxes[24 + 8i + 1 + j].x, arrayOfBoxes[24 + 8i + 1 + j].y - 5, 60, 37);
outerBox.graphics.endFill();
arrayOfBoxes[24 + 8i + 1 + j].type = “input”;
arrayOfBoxes[24 + 8i + 1 + j].background = true;
arrayOfBoxes[24 + 8i + 1 + j].backgroundColor = 0XB0E3F9;
arrayOfBoxes[24 + 8i + 1 + j].setTextFormat(fmt);
arrayOfBoxes[24 + 8*i + 1 + j].textColor = 0X000000;
}
}
But this did not work. Although, the colour of the rectangular box changed, the text field remained non-editable. How can I solve this problem?