# attachMovie explanation

**URL:** <https://forum.kirupa.com/t/attachmovie-explanation/104698>\
**Category:** Uncategorized\
**Created:** [March 18, 2004, 6:45pm UTC](https://forum.kirupa.com/t/attachmovie-explanation/104698 "2004-03-18T18:45:35Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![cookie](https://avatars.discourse-cdn.com/v4/letter/c/d26b3c/32.png) [@cookie](https://forum.kirupa.com/u/cookie)\
**Post date:** [March 18, 2004, 6:45pm UTC](https://forum.kirupa.com/t/attachmovie-explanation/104698/1 "2004-03-18T18:45:35Z")

</div>

I’m trying to understand a few lines of this piece of code:

```php
fscommand("allowscale", "false");
var depth:Number = 0;
spacing = 20;
for (x=0; x<5; x++) {
	for (y=0; y<5; y++) {
		tile = gridMC.attachMovie("tile", "tile"+depth, depth++);
		tile._x = spacing*(x+y);
		tile._y = spacing/2*(x-y);
		tile.x = x;
		tile.y = y;
		tile.onRelease = function() {
			trace("x:"+this.x+",y:"+this.y);
		};
	}
}

```

I don’t understand this:

```php
var depth:Number = 0;

```

I understand that “var” is used to define the variable “depth”, but I don’t understand “:Number=0;”

Next:

```php
tile = gridMC.attachMovie("tile", "tile"+depth, depth++);

```

I looked up “attachMovie” in the AS dictionary, but it didn’t clarify enough for me. attachMovie will attach the library item with linkage ID “tile” to the movieclip on the stage called “gridMC”. Then comes the part I don’t understand:

```php
"tile"+depth, depth++

```

Can someone clarify the code above!  
Cheers  
😉
