# Problems with "/ ' +

**URL:** <https://forum.kirupa.com/t/problems-with/58363>\
**Category:** flash\
**Created:** [July 21, 2004, 7:49pm UTC](https://forum.kirupa.com/t/problems-with/58363 "2004-07-21T19:49:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![2nd\_day](https://avatars.discourse-cdn.com/v4/letter/2/a4c791/32.png) [@2nd\_day](https://forum.kirupa.com/u/2nd_day)\
**Post date:** [July 21, 2004, 7:49pm UTC](https://forum.kirupa.com/t/problems-with/58363/1 "2004-07-21T19:49:51Z")

</div>

I’m having problems with this line:

```auto
"_root.mc"+i+".thex" = random(800);

```

it just doesnt work. I want “i” to be a variable number. But I don’t really know how to work with “+ i +”, maybe somebody could tell me something about the use of ", +, / and '.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 21, 2004, 7:59pm UTC](https://forum.kirupa.com/t/problems-with/58363/2 "2004-07-21T19:59:07Z")

</div>

Associative array referencing:

```auto
_root["mc"+i].thex

```

[http://www.kirupaforum.com/forums/showthread.php?t=12082](http://www.kirupaforum.com/forums/showthread.php?t=12082)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 21, 2004, 8:20pm UTC](https://forum.kirupa.com/t/problems-with/58363/3 "2004-07-21T20:20:25Z")

</div>

i don;t really get it yet. i want a duplicated mc to get his thex from \_root.mc1 (or \_root.mc2). Here is my code in frame 1:

```auto
amount = 5;
while (amount>1) {
	duplicateMovieClip(_root.mc, "mc"+i, i);
	setProperty("mc"+i, _y, i*20);
	_root["mc"+i].thex = random(800);
	trace(_root["mc"+i].thex);//_root.thex);
	setProperty("mc"+i, _alpha, random(100));
	i++;
	amount--;
}

```

and this is the code for the mc:

```auto
onClipEvent (load) {
	thex = _root.thex;
	speed = 4;	
}
onClipEvent (enterFrame) {
	x = thex - _x
	_x += x/speed;
}

```
