# \[Flash 8\]\[As2\]

**URL:** <https://forum.kirupa.com/t/flash-8-as2/284643>\
**Category:** flash\
**Created:** [March 21, 2009, 3:41pm UTC](https://forum.kirupa.com/t/flash-8-as2/284643 "2009-03-21T15:41:25Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![tuddy\_xx](https://avatars.discourse-cdn.com/v4/letter/t/73ab20/32.png) [@tuddy\_xx](https://forum.kirupa.com/u/tuddy_xx)\
**Post date:** [March 21, 2009, 3:41pm UTC](https://forum.kirupa.com/t/flash-8-as2/284643/1 "2009-03-21T15:41:25Z")

</div>

Hello guys,

Does anybody know how to work with to a movie clip generated like this:

```auto
for (j=0; j<10; j++) {
    one_mc.duplicateMovieClip("clip["+j+"]_mc",j);
}

```

I just want to skip all this:

```auto
clip0_mc.onPress = function () {...};
clip1_mc.onPress = function () {...};
...................................................
clip40_mc.onPress = function () {...};

```

and make something like this, but something that works.

```auto
for (j=0;j<10;j++) {
    _root["clip["+j+"]_mc"].onPress = function() {...}
}

```

![](http://forum.kirupa.com/uploads/kirupa/1784/942839e9775dce14.gif)  
At someone suggestion I tried this way:

```auto
for (var i:Number = 0; i < 10; i++)
{
    one_mc.duplicateMovieClip("clip" + i + "_mc", i);
    this["clip" + i + "_mc"]._x = i*55;
    this["clip" + i + "_mc"]._y = i*10;
    this["clip" + i + "_mc"].onPress = function () {
        out_txt.text = "i = " + i;
        };
}

```

but the out\_txt always shows “10” I want it to show 0 or 1 or 2 or…

I have an example here: [http://gabriell.sufx.net/test.swf](http://gabriell.sufx.net/test.swf) the last code typed here + one\_mc (the rectangle) + out\_txt(an input text)

I hope I make myself clear:D

Kind regards for reading this.
