5 Replies Latest reply on Jan 23, 2013 4:54 PM by Ned Murphy

    creating an array of text frames [AS2]

    Trevorׅ Adobe Community Professional

      Hi

       

      I want to create an array of text frames.

       

      The code I am using is.

       

      for (c=0; c<5; c++) {
          tf = ("test_txt"+c.toString());
          this.createTextField(tf, 10, c*20, 80, 40, 20);
      }
      
      a = [test_txt0, test_txt1, test_txt2, test_txt3, test_txt4];
      
      for (c=0; c<5; c++) {
          a[c].text = "foo " + c.toString();
          a[c].border = true;
          a[c].borderColor = 0x00FF00;
          a[c].textColor = 0x0000FF;
          a[c].size = 24;
      }
      

       

      The result that I want from the code is 5 text frames spead across the stage but only the last text frame is being created.

      Untitled-4.png

      What is the proper way of creating the frames by a loop and having then accsesible in an array?

       

      Thanks in advance

       

      Trevor