# Fading grid effect wont work in preloader and transition?

**URL:** <https://forum.kirupa.com/t/fading-grid-effect-wont-work-in-preloader-and-transition/93471>\
**Category:** Uncategorized\
**Created:** [October 31, 2003, 11:45am UTC](https://forum.kirupa.com/t/fading-grid-effect-wont-work-in-preloader-and-transition/93471 "2003-10-31T11:45:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![robbie\_star](https://avatars.discourse-cdn.com/v4/letter/r/ee7513/32.png) [@robbie\_star](https://forum.kirupa.com/u/robbie_star)\
**Post date:** [October 31, 2003, 11:45am UTC](https://forum.kirupa.com/t/fading-grid-effect-wont-work-in-preloader-and-transition/93471/1 "2003-10-31T11:45:00Z")

</div>

Hi guys

Got a bit of a problem, i have main.swf that has a preloader and transition to load external movies in it. In one of the external movies i used the fading grid effect on the backround pic. If you view the external movie on its own it works fine but when i try and view it on the main.swf page nothing happens. I think imaybe the actionscript of the fading grid effect needs to have a bit of a twick for it to work. Im dum when it comes to AS so im going to post it aswell. Please realy need help with this.

Thanks

🙂

//Declare variables  
xspacing = box.\_width;  
yspacing = box.\_height;  
depth = 0;  
box.\_visible = 0;  
azcount = 0;  
smoothness = 85;  
//Calculate positions and values  
amH = Math.ceil(image.\_width/box.\_width);  
amV = Math.ceil(image.\_height/box.\_height);  
border.\_height = image.\_height+1;  
border.\_width = image.\_width+1;  
border.\_x = image.\_x-0.5;  
border.\_y = image.\_y-0.5;  
//Create grid  
for (i=0; i\<amH; i++) {  
for (var k = 0; k\<amV; k++) {  
box.duplicateMovieClip(“box”+depth, depth);  
cur = this[“box”+depth];  
cur.\_x = image.\_x+(xspacing_i);  
cur.\_y = image.\_y+(yspacing_k);  
depth++;  
}  
}  
//  
//  
// End of grid  
//  
//  
function fadeOut(startboxnr, speed) {  
fadeMC(startboxnr, speed);  
}  
function fadeMC(mcnr, speed) {  
azcount++;  
\_root[“box”+mcnr].onEnterFrame = function() {  
\_root[“box”+mcnr].\_alpha -= speed;  
if (\_root[“box”+mcnr].\_alpha\<=smoothness) {  
\_root[“box”+mcnr].onEnterFrame = null;  
continueFade(\_root[“box”+mcnr], speed);  
mcnr += 1;  
fadeOut(mcnr, speed);  
}  
};  
}  
function continueFade(mc, speed) {  
mc.onEnterFrame = function() {  
mc.\_alpha -= speed;  
if (mc.\_alpha\<=0) {  
delete mc.onEnterFrame;  
}  
};  
}  
fadeOut(0, 5);
