# Flash 8 - using a variable to target a movie clip

**URL:** <https://forum.kirupa.com/t/flash-8-using-a-variable-to-target-a-movie-clip/328052>\
**Category:** flash\
**Created:** [April 15, 2012, 8:10pm UTC](https://forum.kirupa.com/t/flash-8-using-a-variable-to-target-a-movie-clip/328052 "2012-04-15T20:10:21Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ghostfishe](https://avatars.discourse-cdn.com/v4/letter/g/dbc845/32.png) [@Ghostfishe](https://forum.kirupa.com/u/Ghostfishe)\
**Post date:** [April 15, 2012, 8:10pm UTC](https://forum.kirupa.com/t/flash-8-using-a-variable-to-target-a-movie-clip/328052/1 "2012-04-15T20:10:21Z")

</div>

I found [this tutorial](http://www.darknews.com/2006/10/18/flash-tip-referencing-movieclip-instances-using-variables/) which seems to do exactly what I’m trying to do (the only one I’ve found to date), except his technique doesn’t seem to work for me at all. It doesn’t really seem to say anywhere which version of Actionscript he uses, but at least it seems to show that what I’m trying to do is possible for _someone_, which is a start.

I’m trying to do exactly what he describes–I have several squares on a grid that are numbered, eg. grid\_0101, grid\_0102, grid\_0103, and so on, for about 100 squares altogether, and I want to be able to target a given square dynamically.

This is the basis of the code I started with:

```auto
var digsquare_x:String = "01";
var digsquare_y:String = "03";
var digthis:String = "grid_" + digsquare_x + digsquare_y;
this[digthis]._alpha = 50;

```

I don’t need to change the alpha specifically, I was just trying to see if I could get it to affect a given square in any way, and apparently the answer is no. I know that the value of “digthis” is accurate, but even blatantly telling it to refer to \_level10[digthis] still gives me no results. Neither does \_root.level10[digthis] which I tried just to see if it would work. The tutorial seemed like a good starting point, but no matter what I do nothing happens, and I’m stumped.

What am I doing wrong? Is there a way to do this in AS2? Being able to use this technique would make a lot of the projects I’ve been working on _much_ simpler, if I could get it to work. Any help would be greatly appreciated!
