# Fading grids

**URL:** https://forum.kirupa.com/t/fading-grids/134300
**Category:** Uncategorized
**Created:** [January 17, 2005, 6:07pm UTC](https://forum.kirupa.com/t/fading-grids/134300 "2005-01-17T18:07:44Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![icio](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/icio/32/484_2.png) [@icio](https://forum.kirupa.com/u/icio)
#### Post date: [January 17, 2005, 6:07pm UTC](https://forum.kirupa.com/t/fading-grids/134300/1 "2005-01-17T18:07:44Z")

</div>

here’s an effect i made that is to do with fading grids - hopefully this will help someone. i know there’s a lot of people wondering how to code this.

i made the code very easy to adapt for yourself to use so please enjoy 🙂 here is a basic example of one:

[center][swf=http://www.kirupa.com/forum/attachment.php?attachmentid=8410&stc=1]height= 600 width=400[/swf][/center]

here’s some replacement functions. they’re the first ones that i made. not nearly as nice, but you can have a look:

```auto
MovieClip.prototype.createGrid = function(x1:Number, x2:Number, y1:Number, y2:Number) {
	x = x1;
	y = y1;
	_root.handle.onEnterFrame = function() {
		tile = _root.attachMovie("tile", "tile_"+x+"_"+y, objCount);
		objCount++;
		tile._x = x*width;
		tile._y = y*height;
		tile._alpha = 0;
		tile.fadeIn();
		//
		x++;
		if (x>x2) {
			x = x1;
			y++;
			if (y>y2) {
				delete _root.handle.onEnterFrame;
				doneAction();
			}
		}
	};
};
MovieClip.prototype.destroyGrid = function(x1:Number, x2:Number, y1:Number, y2:Number) {
	x = x2;
	y = y2;
	_root.handle.onEnterFrame = function() {
		tile = _root["tile_"+x+"_"+y];
		tile.fadeOut();
		x--;
		if (x<x1) {
			x = x2;
			y--;
			if (y<y1) {
				delete _root.handle.onEnterFrame;
				doneAction();
			}
		}
	};
};

```
