# onRelease vs for loop

**URL:** <https://forum.kirupa.com/t/onrelease-vs-for-loop/330453>\
**Category:** flash\
**Created:** [January 24, 2013, 8:33am UTC](https://forum.kirupa.com/t/onrelease-vs-for-loop/330453 "2013-01-24T08:33:50Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![JohnCar](https://avatars.discourse-cdn.com/v4/letter/j/d78d45/32.png) [@JohnCar](https://forum.kirupa.com/u/JohnCar)\
**Post date:** [January 24, 2013, 8:33am UTC](https://forum.kirupa.com/t/onrelease-vs-for-loop/330453/1 "2013-01-24T08:33:50Z")

</div>

hi.  
I need to get the x, y.I can not convert AS2 to AS3.  
AS2:

```auto

for (x = 0; x < 5; x++){
    for (y = 0; y < 5; y++){  
        var tile = mc.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);
        } 
    }
}

```

How to get this.x, this.y in AS3?  
I tried:

```auto

  tile.addEventListener("click",onClick);
function onClick(e:Event){
      trace(e.target.x+","+e.target.y);
     //trace(this.x+","+this.y);
}

```

who can help me?  
thanks for help
