# \[F8/FMX\] Functions on "attachMovie()" clip instances

**URL:** <https://forum.kirupa.com/t/f8-fmx-functions-on-attachmovie-clip-instances/205703>\
**Category:** flash\
**Created:** [November 1, 2006, 4:05am UTC](https://forum.kirupa.com/t/f8-fmx-functions-on-attachmovie-clip-instances/205703 "2006-11-01T04:05:50Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![MSinclair](https://avatars.discourse-cdn.com/v4/letter/m/ebca7d/32.png) [@MSinclair](https://forum.kirupa.com/u/MSinclair)\
**Post date:** [November 1, 2006, 4:05am UTC](https://forum.kirupa.com/t/f8-fmx-functions-on-attachmovie-clip-instances/205703/1 "2006-11-01T04:05:50Z")

</div>

Okay, here is what I am trying to do, and I have attempted it several different ways…

I would like to generate a grid of squares (movieclip `clip_Square` with Export for AS Linkage). The grid generates just fine 10x10, as expected. However, in addition to having this grid, I would like to be able to reference properties of each individual square when they are clicked on. Unfortunately, the function only references the last movieclip, not the movieclip being clicked (onMouseUp).

And if you replace **txtDebug.text = “Square\_”+i;** with **trace(this.\_name);**, the output window displays the names of every square when you click one.

What am I doing wrong? Is there a tutorial someone could point me towards…? Any help would be greatly appreciated.

Thank you very much in advance!

PS: Happy Halloween! 🔗

```auto
function init_Game() {
    x = 0;
    y = 0;
    
    for (i = 1; i <= grid; i++) {
        attachMovie("clip_Square", "Square_" + i, i);
        _root["Square_" + i]._x = x * 65 + 50;
        _root["Square_" + i]._y = y * 65 + 50;
        _root["Square_"+i].onMouseUp = function() {
            txtDebug.text = "Square_"+i;
        }
        ++x;
        if (x >= 10) {
            x = 0;
            y++;
        }
    }
}

init_Game();
stop();

```
