# Array, Variables & For Loops - Oh my!

**URL:** <https://forum.kirupa.com/t/array-variables-for-loops-oh-my/211468>\
**Category:** flash\
**Created:** [January 1, 2007, 11:35pm UTC](https://forum.kirupa.com/t/array-variables-for-loops-oh-my/211468 "2007-01-01T23:35:43Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Soig](https://avatars.discourse-cdn.com/v4/letter/s/eada6e/32.png) [@Soig](https://forum.kirupa.com/u/Soig)\
**Post date:** [January 1, 2007, 11:35pm UTC](https://forum.kirupa.com/t/array-variables-for-loops-oh-my/211468/1 "2007-01-01T23:35:43Z")

</div>

Ok ok ok, so lions tigers and bears are more interesting! But this is an actionscript forum!

I’ve linked two Arrays with a for loop and I’ve converted the arrays to variables so that I can easily call them. HOWEVER, I CAN’T SEEM To USE THEM!! ![](http://gotoandlearn.com/forum/images/smiles/icon_mad.gif)

The part that is giving me problems is in **Bold** - everything else works. When I make that part into **xVar = sensorSize1;** - then it works, but that’s not exactly dynamic…

I’d like to make it so that when the user clicks either of the 12 buttons, it will call the sensor size from the _sensorSize_ array. Can anyone help?? Thanks

> //THIS FOR LOOP SETS THE 12 BUTTON SETTINGS  
> for (var i = 1; i\<13; i++) {  
> this[“textFieldCell”+i].textArea = this.textFieldCell\*;  
> this[“sensorSize”+i] = this.sensorSize\*;  
> var btn = this[“textFieldCell”+i];  
> btn.id = i;  
> btn.onRelease = function() {  
> xVar = sensorSize\*;  
> convertVariables;  
> }

* * *
