# For in loop question

**URL:** <https://forum.kirupa.com/t/for-in-loop-question/120703>\
**Category:** Uncategorized\
**Created:** [August 26, 2004, 5:58pm UTC](https://forum.kirupa.com/t/for-in-loop-question/120703 "2004-08-26T17:58:44Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![fugzi](https://avatars.discourse-cdn.com/v4/letter/f/c67d28/32.png) [@fugzi](https://forum.kirupa.com/u/fugzi)\
**Post date:** [August 26, 2004, 5:58pm UTC](https://forum.kirupa.com/t/for-in-loop-question/120703/1 "2004-08-26T17:58:44Z")

</div>

Hi Im using a for in loop to grab the names of my mc on the \_root timeline and push() them into an array named bricks. i then use a prototype function fade them in one at a time. The problem is that it only works to a piont and then stops.

I thought posible causes could be the time it takes to build the array as i do have 713 mc on my timeline.

this is my code i tried attaching the fla but its to big

fadespeed = 9;  
function init(){  
brick = new Array();  
for(var prop in \_root){  
if(typeof \_root[prop] ==“movieclip”){  
brick.push(\_root[prop]);  
}  
for( var i = 0; i\<brick.length; i++) {  
brick\*.\_alpha = 0;  
brick\*.id = i;  
}  
brick[0].fade();  
}  
}  
MovieClip.prototype.fade = function() {  
this.go = true;  
this.onEnterFrame = function() {  
this.\_alpha += fadespeed;  
if (this.go) {  
if (this.\_alpha\<50) {  
this.go = false;  
brick[this.id+1].fade();  
}  
}  
if (this.\_alpha\>=100) {  
delete this.onEnterFrame;  
}  
};  
};  
init();

thank you
