I am trying to create a grid based on users input. I have two input text boxes on the stage one for width and one for height and a movieClip called grid in the library. If the user types in a number in the text box I want the grid to appear. Right now the grid only appears if both text boxes are filled I am not sure what I am doing wrong.
[FONT=Courier New]
[/FONT]
[FONT=Courier New]//
height_txt.onChanged = function(textfield_txt:TextField) {
ht = textfield_txt.text;
};
var txtListener:Object = new Object();
txtListener.onChanged = function(textfield_txt:TextField) {
displayFloor();
};
height_txt.addListener(txtListener);
//
width_txt.onChanged = function(textfield_txt:TextField) {
wt = textfield_txt.text;
};
var txtListener:Object = new Object();
txtListener.onChanged = function(textfield_txt:TextField) {
displayFloor();
};
width_txt.addListener(txtListener);
//
displayFloor = function () {
depth = 10000;
for (x=0; x<wt; x++) {
for (y=0; y<ht; y++) {
this.attachMovie("grid", "c"+ ++depth, depth);
this["c"+depth]._x = x*50+200;
this["c"+depth]._y = y*50+50;
}
}
};
[/FONT]