# Help with functions and input text

**URL:** <https://forum.kirupa.com/t/help-with-functions-and-input-text/201947>\
**Category:** Uncategorized\
**Created:** [September 26, 2006, 2:15pm UTC](https://forum.kirupa.com/t/help-with-functions-and-input-text/201947 "2006-09-26T14:15:53Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Navarone](https://avatars.discourse-cdn.com/v4/letter/n/f9ae1b/32.png) [@Navarone](https://forum.kirupa.com/u/Navarone)\
**Post date:** [September 26, 2006, 2:15pm UTC](https://forum.kirupa.com/t/help-with-functions-and-input-text/201947/1 "2006-09-26T14:15:53Z")

</div>

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]

```auto
[/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]
