Looping through all instances on the stage?

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?

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:

that should work!