1 Reply Latest reply on Apr 2, 2007 2:22 PM by abeall

    Concatonate variable name in for / next loop

    mickey_moose
      I have a for / next loop where I want to read the value of a series of checkbox components:

      function resetNow(){
      for (i=1; i<7; i++) {
      trace(["answer"+i].value);
      }
      }

      the checkboxes are named "answer1", "answer2", etc.

      if I change the function to "trace(answer2.value);" it shows the value of answer2 6 times.

      If I leave it as "trace(["answer"+i].value);" I get six "undefined"

      I hope there is an easy solution!
      Thanks.