PDA

View Full Version : Problems with fading grid!



Pat
February 5th, 2004, 09:35 AM
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!

claudio
February 5th, 2004, 01:22 PM
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.

OBCT
February 5th, 2004, 08:15 PM
Pat,

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

Cheers

Pat
February 6th, 2004, 02:38 AM
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);



..............................................

OBCT
February 6th, 2004, 02:47 AM
Your first problem is that the variable 'speed' has no value.
Theres probably a few minor errors, I just have to find them.

Pat
February 6th, 2004, 02:53 AM
Thanks man! :)

Its strange that the code wont work since its an tutorial posted on this site.. or maybe its me :)

OBCT
February 6th, 2004, 03:03 AM
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

Pat
February 6th, 2004, 03:19 AM
Thanks man! Now it finaly works! Seems that i had missed some stuff. Your version was more easy to understand!

Thank you alot!

OBCT
February 6th, 2004, 03:21 AM
Your welcome :)

Cheers

Voetsjoeba
February 6th, 2004, 01:55 PM
Boy ... I really need to get that ugly _root fixed :!: