# as3 grid problems

**URL:** https://forum.kirupa.com/t/as3-grid-problems/255780
**Category:** flash
**Created:** [March 26, 2008, 9:29pm UTC](https://forum.kirupa.com/t/as3-grid-problems/255780 "2008-03-26T21:29:28Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![knickers95](https://avatars.discourse-cdn.com/v4/letter/k/a8b319/32.png) [@knickers95](https://forum.kirupa.com/u/knickers95)
#### Post date: [March 26, 2008, 9:29pm UTC](https://forum.kirupa.com/t/as3-grid-problems/255780/1 "2008-03-26T21:29:28Z")

</div>

hey guys:D

im still struggling with the switch over from as2 to as3. to begin with, let me tell u what i want to acheive. if i want to create a drig using as2 i woud say:

```auto
this.createEmptyMovieClip("gridHolder",0);
for(i=0;i<10;i++){
gridHolder.attachMovie("gridItem","gridItem"+i,this.getNextHighestDepth());
//rest of code
}

```

and by doing it this way i can access any of the items attached to the gridHolder movieclip, because it would be stored in an array. for example:

```auto
trace(gridHolder[0])

```

that would return the name of the first movieclip.

Now heres my as3 problem. i use this method to create my grid stuff:

```auto
for(var i:uint =0; i<10; ++)
{
var item:gridItem = new gridItem();
holder.addChild(item); //holder movieclip is already on the display list
//rest of code
}

```

How could i write some code, so that when i click on one of these items it would return the name of the movieclip, or just the “i” variable.
