2 Replies Latest reply on Jul 23, 2008 4:54 AM by bhnh

    arrays in text fields

    bhnh
      Issue 1:
      I've got an array... var a1:Array = [1,2,3,4,5]... that I'd like to display in a dynamic text field like so:
      1
      2
      3
      4


      When I try the following code...

      for(var k:Number=0;k<a1.length;k++){ myTextField.text = a1[k]; }

      all I get is the last index. I know I've got to create another variable somewhere, but I'm stumped.

      Issue 2:
      I've got a second array... var a2:Array = [A,B,C,D,E]... that I'd like to display in a text field like so: a1[k] +"-"+a2[k] to wind up with something like this...

      1-A
      2-B
      3-C
      4-D
      5-E


      I've tried a bunch of variations, but I'm stumped. Any advice on these issues would be hugely appreciated. Thanks in advance.