I’m currently working on a project where I need to create a grid of dynamic text boxes each displaying my specified number. I won’t go into big specifics, since I can assign the values to each text box, but for some reason I’m having problems creating the grid dynamically. I’ve used the same method for attaching Movie Clips in a grid, and it works fine, so I can’t figure out for the life of me what the problem is.
Here’s the code
[AS]
counter = 0;
for(var k=1;k<=20;k++){
for(var l=1;l<=20;l++){
counter++;
text_container.createTextField("textbox"+counter);
text_container["textbox"+counter]._x = initX - 5;
text_container["textbox"+counter]._y = initY - 5;
text_container["textbox"+counter].text = 'Hi'
text_container["textbox"+counter].selectable = false;
text_container["textbox"+counter].embedFonts = true;
text_container["textbox"+counter].setTextFormat(_root.myformat);
trace(text_container["textbox"+counter]); // Traces Undefined
initX +=10;
}
initY +=10;
initX = 15;
}
[/AS]
Here’s the code I’m using to attach Movie Clips, which is working fine.
[AS]
for(var i=1;i<=20;i++){
for(var j=1;j<=20;j++){
counter++;
grid_container.attachMovie(“Block”,“block”+counter,counter);
grid_container[“block”+counter]._x = initX;
grid_container[“block”+counter]._y = initY;
grid_container[“block”+counter].swatch = 15;
grid_container[“block”+counter].number = counter;
initX +=10;
}
initY +=10;
initX = 15;
}
[/AS]
Any help would be appreciated!