5 Replies Latest reply on Aug 29, 2006 8:58 AM by Newsgroup_User

    dynamically creating variables inside of a loop

    Level 7
      Flash 8, AS 2

      Let's say i'm looping through an array and want to create variables from
      elements in that array, like this:

      for (var i:Number = 0; i < data_array; i++) {
      // create a variable in the format team1Score = 5
      this["team" + i + "Score"] = data_array [0];
      }

      Obviously, Flash won't let me do this, so how do I accomplish what i'm
      trying to do?

      Thanks,

      Chris