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();
I don`t think that there is anything wrong with your code,its just too much to do. I tried this which is basically the same
brick = ;
fadespeed = 2;
for (var i = 0; i<100; i++) {
myclip = attachmovie(“mc”, “mc”+i, i);
myclip._x = random(700);
myclip._y = random(500);
myclip.id = i;
myclip._alpha = 0;
brick.push(myclip);
}
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;
}
};
};
brick[0].fade();
worked fine for 100 but broke down for 700.Varying transparency is really hard on processor too