# tellTarget + duplicateMovieClip problem

**URL:** https://forum.kirupa.com/t/telltarget-duplicatemovieclip-problem/632
**Category:** flash
**Created:** [July 24, 2002, 11:41am UTC](https://forum.kirupa.com/t/telltarget-duplicatemovieclip-problem/632 "2002-07-24T11:41:15Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![vermaha](https://avatars.discourse-cdn.com/v4/letter/v/df788c/32.png) [@vermaha](https://forum.kirupa.com/u/vermaha)
#### Post date: [July 24, 2002, 11:41am UTC](https://forum.kirupa.com/t/telltarget-duplicatemovieclip-problem/632/1 "2002-07-24T11:41:15Z")

</div>

+++ CASE +++  
I’m doing a duplicateMovieClip and that works fine. But I can’t seem to trigger any actions like gotoAndPlay(nextFrame) in a duplicated mc from another duplicated mc… unless I hardcode a target.

+++ trial and error +++  
if I prepare a string and use it as a target, it won’t work. If I hardcode it the tellTarget works fine. What am I doing wrong?

\> WORKS:  
str = “\_root.system.menu.template2”;  
tellTarget(str) { doSomething(); }

\> DOES NOT WORK:  
// textfield with one of the duplicated movieclip names  
pmc = \_root.system.menu.txt;  
str = “\_root.system.menu.” add pmc;  
tellTarget(str) { doSomething(); }

\> When I do a trace(str) on that string it seems to be correct. I’ve also tried using a valueOf() but that does not help me.

situation:  
\> A movieclip is duplicated (the original was named “template” and the duplicates get a number attached to that) there’s a button with a small script.  
\> In the movieclip that holds the duplicate mcs, I store a variable (txt) with the name of the movie clip where a button has last been clicked on. It has a value like “template1”.

Thanks a lot for the help!

---

<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 24, 2002, 12:55pm UTC](https://forum.kirupa.com/t/telltarget-duplicatemovieclip-problem/632/2 "2002-07-24T12:55:43Z")

</div>

> \*Originally posted by vermaha \*  
> **\> DOES NOT WORK:  
> // textfield with one of the duplicated movieclip names  
> pmc = \_root.system.menu.txt;  
> str = “\_root.system.menu.” add pmc;  
> tellTarget(str) { doSomething(); }**  
> Wait a second. If you trace str, there’s no way this can be correct.  
> str=\_root.system.menu.\_root.system.menu.txt in your case…

pom :asian:

---

<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 24, 2002, 1:16pm UTC](https://forum.kirupa.com/t/telltarget-duplicatemovieclip-problem/632/3 "2002-07-24T13:16:21Z")

</div>

I might well omit the pmc var. I don’t think there’s something wrong with that?? \_root.system.menu is not between quotes so it refers to the value in the dynamic textfield var called txt.

\> pmc = \_root.system.menu.txt;  
trace(pmc);

then I get that value; for example “template1”

when I combine the two strings pmc + the rest into one new string. When I do a trace() of that new string I get this perfect result. That’s what I described in my first post.

\> “\_root.system.menu.template1”

There is no problem at all… but I can’t USE that result as a target… What’s wrong?

---

<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 24, 2002, 1:48pm UTC](https://forum.kirupa.com/t/telltarget-duplicatemovieclip-problem/632/4 "2002-07-24T13:48:28Z")

</div>

I don’t know what’s wrong. But I do know 2 things:

- tellTarget sucks, go for the dot syntax
- this works:

```auto
// Imagine that "template1 is contained inside the variable "path"
_root.system.menu[path]._x++;
// for instance

```

This will evaluate path all right. Careful, no . before the []. Tell me how this works.

pom :asian:
