# Help with variable in a loop

**URL:** <https://forum.kirupa.com/t/help-with-variable-in-a-loop/297170>\
**Category:** flash\
**Created:** [September 26, 2009, 6:30pm UTC](https://forum.kirupa.com/t/help-with-variable-in-a-loop/297170 "2009-09-26T18:30:28Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![badAtAS3](https://avatars.discourse-cdn.com/v4/letter/b/f07891/32.png) [@badAtAS3](https://forum.kirupa.com/u/badAtAS3)\
**Post date:** [September 26, 2009, 6:30pm UTC](https://forum.kirupa.com/t/help-with-variable-in-a-loop/297170/1 "2009-09-26T18:30:28Z")

</div>

I am trying to pass the text from an input text box to a sender variable called variables. The first line of code works fine, but how do I make it dynamic so I can use a loop to load the “first” names into variables.first1, variables.first2, etc.

This works great…

variables.first1 = this[“first”+i+"\_txt"].text;

But when I try to make the left side of the statement dynamic, it does not work.

this[“variables.first”+i] = this[“first”+i+"\_txt"].text;

Any help would be appreciated.

Thanks,  
John
