2 Replies Latest reply on Oct 12, 2008 11:46 PM by luciewong

    Array and deleted element

    luciewong Level 1
      Hi,
      I have a Form with 6 input Text fields.
      Now the Submit button should find out, if all Text fields are defined.

      The Array is updated on enter text with >splice< like

      var a:Number = 0;//
      while(a<6){
      this["formTF"+a].onChanged = function(txt){
      var theText = txt.text;
      var theNo:Number = this.avar;
      theSubmit_array.splice(theNo,1,theText);
      };
      a++;
      }

      All works fine, I have an array like this > AA,BB,CC,DD,EE,FF <

      But, when the TF is left empty or previous entered Text is deleted, lets say TF no.2, then
      my Array looks like >> AA,,CC,DD,EE,FF < so… BB is gone and I have an empty space.

      How can the Submit button read, that the TF no 2 is empty???
      I have tried so many things during 2 days, but found no solution.
      For ex. looping through the array like:

      for(var x:Number=0,x<theSubmit_array.length;x++)
      var checkStr = theSubmit_array[x];
      if(checkStr == ""){
      //play error
      }
      }
      // but does not work.

      Can anyone help me please??
      Thanks.