Hi all
I need your help
just worked over the Tutorial “fading Grid” and it works fine.
here is the tutorial:
http://www.kirupa.com/developer/mx/fadegrid.htm
BUT: I desperatly tried to trigger the script (by calling the function fadeOut() )
with a button action and NOT with an “onEnterFrame”.
I tried everything, well it seems for a newbie like me to hard.
Can anyone help me, triggering the script by pressing a button
Here’s the script
//Declare variables
xspacing = box._width;
yspacing = box._height;
depth = 0;
box._visible = 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 (var k = 0; k<amV; k++) {
for (i=0; i<amH; i++) {
box.duplicateMovieClip(“box”+depth, depth);
cur = this[“box”+depth];
cur._x = image._x+(xspacingi);
cur._y = image._y+(yspacingk);
depth++;
}
}
function fadeOut(startboxnr, speed) {
fadeMC(startboxnr, speed);
}
function fadeMC(mcnr, speed) {
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, 25);