A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: ForLoop string

  1. #1
    Junior Member
    Join Date
    Jun 2009
    Posts
    6

    ForLoop string

    I want to put multiple inputtext values into an array, but code below wont work.

    This is the inputTextFields:
    output1.text
    output2.text

    Simply dont know how to write it, tried:
    output +i+ "." +text;
    output +i+ ".text";

    Code:
    for (var i = 1; i<3; i++) {
    	tempArray[i] = output +i+.text   //<Problem here
    }

  2. #2
    flash absorption vessel
    Join Date
    Jul 2009
    Posts
    31
    Here ya go--
    Code:
    for (var i = 1; i<3; i++) {
    	tempArray[i]=this['output'+i].text;
    }

  3. #3
    Junior Member
    Join Date
    Jun 2009
    Posts
    6

    resolved

    Thank you, works beautifully

  4. #4
    Junior Member
    Join Date
    Jun 2009
    Posts
    6
    If I were to put the textfields into a movieclip called menu, how would I call it then?

    This didnt seem to work
    Code:
    tempArray[i]= menu.this['output'+i].text;

  5. #5
    flash absorption vessel
    Join Date
    Jul 2009
    Posts
    31
    Since 'this' refers to the object you are typing into (probably the timeline in this case?), it is unnecessary. Just menu['output'...

    Remember too that arrays are 0-index, so they start at 0 not 1.

  6. #6
    Junior Member
    Join Date
    Jun 2009
    Posts
    6

    Thumbs up

    Thanks again

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center