# Simple looping question

**URL:** <https://forum.kirupa.com/t/simple-looping-question/214777>\
**Category:** Uncategorized\
**Created:** [January 31, 2007, 10:50pm UTC](https://forum.kirupa.com/t/simple-looping-question/214777 "2007-01-31T22:50:34Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![albino](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/albino/32/1022_2.png) [@albino](https://forum.kirupa.com/u/albino)\
**Post date:** [January 31, 2007, 10:50pm UTC](https://forum.kirupa.com/t/simple-looping-question/214777/1 "2007-01-31T22:50:34Z")

</div>

ok, sorry, I had a quick search but I couldn’t find the answer, so I thought I’d ask here!

Pretty much, I have 5 objects, lets say for arguments sake:

item1  
item2  
item3  
…  
item5

say each has a value (itemX.selected), and I want to set all of their selected values to yes, but I dont want to write out:

item1.selected = “yes”;  
item2.selected = “yes”;  
item3.selected = “yes”;  
etc

this becomes very tedious, as I have quite a few values I need to change.

so, how can I use a for loop to do this?

for (i=0;i=4;i++){  
item+i.selected=true  
}

I know that doesnt work, but hopefully you get the idea. Is there anyway to do this? I know in visual basic, you had to create a control array, is there such a feature in flash?

any help would be grea cheers!
