# Calling Array items in a FOR Loop

**URL:** <https://forum.kirupa.com/t/calling-array-items-in-a-for-loop/180043>\
**Category:** flash\
**Created:** [February 24, 2006, 11:16pm UTC](https://forum.kirupa.com/t/calling-array-items-in-a-for-loop/180043 "2006-02-24T23:16:21Z")\
**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:** [February 24, 2006, 11:16pm UTC](https://forum.kirupa.com/t/calling-array-items-in-a-for-loop/180043/1 "2006-02-24T23:16:21Z")

</div>

Hey guys, I need help Calling Array items in a FOR Loop. I have included the array and the for Loop below. Everything works except for the bold, red line. Any help would be great!

> 

```
//Creates array to hold Body content

```

var bodies = new Array();  
bodies[0] = “”;  
bodies[1] = “Glit body”;  
bodies[2] = “Scar body”;  
bodies[3] = “Lab body”;  
bodies[4] = “Box body”;  
bodies[5] = “Snap body”;  
bodies[6] = “DHI body”;  
bodies[7] = “Max body”;

//DECLARE BUTTON PROPERTIES  
for(i=0;i\<9;i++) {  
\_root.field[“cell”+i].onPress = function () { this.gotoAndPlay(“down”);}  
\_root.field[“cell”+i].onRelease = function () { this.gotoAndPlay(“over”);  
[COLOR=Red]\*\* \_root.field.captionBodyDisp = bodies\*;}\<– this does not work. it results in undefined because it looks for the last possible number in the array and stays there. \*\*[/COLOR]  
\_root.field[“cell”+i].onRollOver = function () { this.gotoAndPlay(“over”);}  
\_root.field[“cell”+i].onRollOut = function () { this.gotoAndPlay(“up”);}  
\_root.field[“cell”+i].onDragOut = function () { this.gotoAndPlay(“up”);}  
}
