# Fading grid effect wont work in preloader and transition?

**URL:** <https://forum.kirupa.com/t/fading-grid-effect-wont-work-in-preloader-and-transition/34323>\
**Category:** flash\
**Created:** [October 31, 2003, 11:45am UTC](https://forum.kirupa.com/t/fading-grid-effect-wont-work-in-preloader-and-transition/34323 "2003-10-31T11:45:00Z")\
**Posts on this page:** 4\
**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/34323/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);

---

<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:** [October 31, 2003, 12:17pm UTC](https://forum.kirupa.com/t/fading-grid-effect-wont-work-in-preloader-and-transition/34323/2 "2003-10-31T12:17:23Z")

</div>

```auto

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++;
this["box"+mcnr].onEnterFrame = function() {
this._alpha -= speed;
if (this._alpha<=smoothness) {
this.onEnterFrame = null;
continueFade(this, speed);
mcnr += 1;
fadeOut(mcnr, speed);
}
};
}
function continueFade(mc, speed) {
mc.onEnterFrame = function() {
this._alpha -= speed;
if (this._alpha<=0) {
delete this.onEnterFrame;
}
};
}
fadeOut(0, 5);

```

Please search before asking, this has been answered before.

---

<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:** [October 31, 2003, 3:08pm UTC](https://forum.kirupa.com/t/fading-grid-effect-wont-work-in-preloader-and-transition/34323/3 "2003-10-31T15:08:14Z")

</div>

Once again thanks for your help Voetsjoeba in sorting this problem out for me.  
I’m sorry if i upset u by not doing a search for this but i did not know what to search for. BIG SORRY MATE

---

<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:** [October 31, 2003, 3:13pm UTC](https://forum.kirupa.com/t/fading-grid-effect-wont-work-in-preloader-and-transition/34323/4 "2003-10-31T15:13:23Z")

</div>

Lol, it’s nothing mate, just some advice to find your anwer faster 🙂
