# Dynamicaly name arrays

**URL:** <https://forum.kirupa.com/t/dynamicaly-name-arrays/4931>\
**Category:** Uncategorized\
**Created:** [August 25, 2002, 2:26pm UTC](https://forum.kirupa.com/t/dynamicaly-name-arrays/4931 "2002-08-25T14:26:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Zenthril](https://avatars.discourse-cdn.com/v4/letter/z/76d3ee/32.png) [@Zenthril](https://forum.kirupa.com/u/Zenthril)\
**Post date:** [August 25, 2002, 2:26pm UTC](https://forum.kirupa.com/t/dynamicaly-name-arrays/4931/1 "2002-08-25T14:26:22Z")

</div>

Hi  
Could someone tellme why the following script is not working?

on (release) {  
var set1 = [34, 19, -7];  
var set2 = [39, 34, -3];  
var init = “set1[”+0+"]";  
var cond = “set1[”+1+"]";  
for (i=init; i\>cond; i–) {  
if (i == \_root.A.Age) {  
//\_root.A.Age is the input field on the main stage of the movie  
trace(“match”);  
} else {  
trace(“no match”);  
}  
}  
}

thanks  
Then

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 25, 2002, 4:12pm UTC](https://forum.kirupa.com/t/dynamicaly-name-arrays/4931/2 "2002-08-25T16:12:46Z")

</div>

var init = “set1[”+0+"]";  
var cond = “set1[”+1+"]";

should read:

var init = set1[0];  
var cond = set1[1];

also your for loop is a little strange:

for (i=init; i\>cond; i–)

you’re checking if i will be greater than cond, but then your decrementing i each time. if i is higher than cond to start with, it won’t even run once, if it’s less, it’ll run indefinitely.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 25, 2002, 10:37pm UTC](https://forum.kirupa.com/t/dynamicaly-name-arrays/4931/3 "2002-08-25T22:37:50Z")

</div>

supra, just feels good to see a few clear lines from you from time 2 time, right to the point as always…howdy?
