# Iterate through a for loop leaving one index out

**URL:** <https://forum.kirupa.com/t/iterate-through-a-for-loop-leaving-one-index-out/327687>\
**Category:** Uncategorized\
**Created:** [March 20, 2012, 3:02pm UTC](https://forum.kirupa.com/t/iterate-through-a-for-loop-leaving-one-index-out/327687 "2012-03-20T15:02:23Z")\
**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:** [March 20, 2012, 3:02pm UTC](https://forum.kirupa.com/t/iterate-through-a-for-loop-leaving-one-index-out/327687/1 "2012-03-20T15:02:23Z")

</div>

I often need to set the alpha of all but one of a list of objects.

```auto
     
beastie1.alpha = 0;
beastie2.alpha = 1;
beastie3.alpha = 0;
beastie4.alpha = 0;

```

I am wondering what is the best way to do this with a for loop?

```auto
private var beastieArray:Array = new Array(beastie1,beastie2,beastie3,beastie4);

for (var i:int = 0; i < beastieArray.length; i++) 
  {
   beastieArray*.alpha = 0;
  }

```

This loop obviously sets all of the objects in beastieArray to alpha = 0. is there a way to leave one index out of the loop?

Thanks!
