# 1 to index called by for loop?

**URL:** <https://forum.kirupa.com/t/1-to-index-called-by-for-loop/328397>\
**Category:** flash\
**Created:** [May 14, 2012, 4:49pm UTC](https://forum.kirupa.com/t/1-to-index-called-by-for-loop/328397 "2012-05-14T16:49:03Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![bonassus](https://avatars.discourse-cdn.com/v4/letter/b/ea5d25/32.png) [@bonassus](https://forum.kirupa.com/u/bonassus)\
**Post date:** [May 14, 2012, 4:49pm UTC](https://forum.kirupa.com/t/1-to-index-called-by-for-loop/328397/1 "2012-05-14T16:49:03Z")

</div>

I am updating the position of movieClips stored in an array with an enter frame event loop.

```auto
function onEnterFrame(e:Event){         
   areaArray[1].x = areaArray[0].x + areaArray[0].spacing.width;
  areaArray[2].x = areaArray[1].x + areaArray[1].spacing.width;
  areaArray[3].x = areaArray[2].x + areaArray[2].spacing.width;
  areaArray[4].x = areaArray[3].x + areaArray[3].spacing.width;
  areaArray[5].x = areaArray[4].x + areaArray[4].spacing.width;
}

```

I would like to do the same thing with a for loop but cant figure it out. My below example doesn’t work. But in essences this is what i would like to do adding 1 to the index called by the for loop

```auto
function onEnterFrame(e:Event){  
   for (var j:int = 0; j < areaArray.length; j++) {
                areaArray[**[COLOR=#ff0000](j+1)[/COLOR]**].x = areaArray[j].x + areaArray[j].spacing.width;
 
            }
}

```

can someone steer me in the right direction

Thanks!
