3 Replies Latest reply on Feb 21, 2007 6:50 AM by kglad

    Creating a dynamic grid using actionscript

      Hello all:

      I am working on a Flash project which requires that the user input 2 values. These two values will be used as height and width to generate a dynamic grid. I am new to actionscript and am struggling with how to create the 2 input fields and pass the values to actionscript by an event such as the user pressing return. The code below will create the grid correctly based upon the hardcoded variable values hightlighted, but I need the user to enter the values and press return to generate the grid.

      Can anyone suggest the actionscript required to capture the 2 values, send them to actionscript with an event such as pressing return and then have AS generate the grid width and height based upon the user input. The i (10) and j (10) values in line 4 and 5 are the values that I need to have the user input to generate the grid.

      Any help will be most appreciated!

      initX = 0;
      initY = 0;
      counter = 0;
      for (var i = 1; i<=10; i++) {
      for (var j = 1; j<=10; j++) {
      grid_container.attachMovie("cellMC", "cell"+counter, counter);
      grid_container["cell"+counter]._x = initX;
      grid_container["cell"+counter]._y = initY;

      grid_container["cell"+counter].onRelease = function() {
      cellName.text = this._name;
      initX += 30;
      initY += 30;
      initX = 0;