# Input TextField Inside Sprite

**URL:** https://forum.kirupa.com/t/input-textfield-inside-sprite/296375
**Category:** flash
**Created:** [September 14, 2009, 11:43am UTC](https://forum.kirupa.com/t/input-textfield-inside-sprite/296375 "2009-09-14T11:43:04Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![noobie123](https://avatars.discourse-cdn.com/v4/letter/n/ad7895/32.png) [@noobie123](https://forum.kirupa.com/u/noobie123)
#### Post date: [September 14, 2009, 11:43am UTC](https://forum.kirupa.com/t/input-textfield-inside-sprite/296375/1 "2009-09-14T11:43:04Z")

</div>

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 + 60_i, sheet.y + 15 + 37_j, 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.width_i;  
box.y = sheet.y + 15 + box.height_j + 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 + 8_i + 1 + j].x, arrayOfBoxes[24 + 8_i + 1 + j].y - 5, 60, 37);  
outerBox.graphics.endFill();  
arrayOfBoxes[24 + 8_i + 1 + j].type = “input”;  
arrayOfBoxes[24 + 8_i + 1 + j].background = true;  
arrayOfBoxes[24 + 8_i + 1 + j].backgroundColor = 0XB0E3F9;  
arrayOfBoxes[24 + 8_i + 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?
