# Looping through all instances on the stage?

**URL:** <https://forum.kirupa.com/t/looping-through-all-instances-on-the-stage/1718>\
**Category:** Uncategorized\
**Created:** [June 6, 2002, 2:23pm UTC](https://forum.kirupa.com/t/looping-through-all-instances-on-the-stage/1718 "2002-06-06T14:23:39Z")\
**Posts on this page:** 2\
**Page:** 1

<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:** [June 6, 2002, 2:23pm UTC](https://forum.kirupa.com/t/looping-through-all-instances-on-the-stage/1718/1 "2002-06-06T14:23:39Z")

</div>

Is there a way to loop through all the movie clips on the stage, say to find out how many have such and such a string in their name?

---

<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:** [June 6, 2002, 3:36pm UTC](https://forum.kirupa.com/t/looping-through-all-instances-on-the-stage/1718/2 "2002-06-06T15:36:48Z")

</div>

function fFindMcName(mc, sString) {  
for (ii in mc) {  
if (typeof (this[ii]) == “movieclip”) {  
if (this[ii].\_name.indexOf(sString, 0)\>=0) {  
trace(“has “+sString+” in it’s name”);  
// put your actions here.  
}  
}  
}  
}

to call the function:  
fFindMcName(\_root,“string”);

that should work!  
jeremy
