# Problems with fading grid!

**URL:** https://forum.kirupa.com/t/problems-with-fading-grid/42123
**Category:** flash
**Created:** [February 5, 2004, 2:35pm UTC](https://forum.kirupa.com/t/problems-with-fading-grid/42123 "2004-02-05T14:35:16Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![Pat1](https://avatars.discourse-cdn.com/v4/letter/p/43a26b/32.png) [@Pat1](https://forum.kirupa.com/u/Pat1)
#### Post date: [February 5, 2004, 2:35pm UTC](https://forum.kirupa.com/t/problems-with-fading-grid/42123/1 "2004-02-05T14:35:16Z")

</div>

I have some newbie problems following the Fading grid tutorial.  
I have followed the steps exactly but get this error loading the movie;

…

A script in this movie is causing flash player to run slowly. If it continious to run, your computer may become unresponcible. Do you want to abort this script yes, no?

…

Ofcourse i dont want to abort it! What have i done wrong? I just copied and pasted the script as i was told?

Thanks!

---

<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: [February 5, 2004, 6:22pm UTC](https://forum.kirupa.com/t/problems-with-fading-grid/42123/2 "2004-02-05T18:22:48Z")

</div>

That effect uses a lot of enterframe handlers, duplicate mcs and for loops. Maybe you have a picture way too big and/or a small movieclip being dupicated.

---

<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: [February 6, 2004, 1:15am UTC](https://forum.kirupa.com/t/problems-with-fading-grid/42123/3 "2004-02-06T01:15:39Z")

</div>

Pat,

Are you able to post your script for us to find the problem?

Cheers

---

<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: [February 6, 2004, 7:38am UTC](https://forum.kirupa.com/t/problems-with-fading-grid/42123/4 "2004-02-06T07:38:25Z")

</div>

Okay here you go guys!  
I also attatched an screenshot!

Thanks!

…

//Declare variables  
xspacing = box.\_width;  
yspacing = box.\_height;  
depth = 0;  
box.\_visible = 0;  
azcount = 0;  
smoothness = 90;  
//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: [February 6, 2004, 7:47am UTC](https://forum.kirupa.com/t/problems-with-fading-grid/42123/5 "2004-02-06T07:47:57Z")

</div>

Your first problem is that the variable ‘speed’ has no value.  
Theres probably a few minor errors, I just have to find them.

---

<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: [February 6, 2004, 7:53am UTC](https://forum.kirupa.com/t/problems-with-fading-grid/42123/6 "2004-02-06T07:53:29Z")

</div>

Thanks man! 🙂

Its strange that the code wont work since its an tutorial posted on this site… or maybe its me 🙂

---

<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: [February 6, 2004, 8:03am UTC](https://forum.kirupa.com/t/problems-with-fading-grid/42123/7 "2004-02-06T08:03:20Z")

</div>

Sorry I was wrong. There is a speed variable set. I didnt see it lol  
I tried the code out and it worked fine for me.  
If your using Flash 5, I’m not sure if it will work due to changed syntax.

I attached the fla that worked for me. Compare the two and see if you can find anything different.

Cheers

---

<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: [February 6, 2004, 8:19am UTC](https://forum.kirupa.com/t/problems-with-fading-grid/42123/8 "2004-02-06T08:19:46Z")

</div>

Thanks man! Now it finaly works! Seems that i had missed some stuff. Your version was more easy to understand!

Thank you alot!

---

<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: [February 6, 2004, 8:21am UTC](https://forum.kirupa.com/t/problems-with-fading-grid/42123/9 "2004-02-06T08:21:11Z")

</div>

Your welcome 🙂

Cheers

---

<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: [February 6, 2004, 6:55pm UTC](https://forum.kirupa.com/t/problems-with-fading-grid/42123/10 "2004-02-06T18:55:54Z")

</div>

Boy … I really need to get that ugly \_root fixed :!:
