# How to pass variables to attachMovie syntax

**URL:** <https://forum.kirupa.com/t/how-to-pass-variables-to-attachmovie-syntax/63246>\
**Category:** flash\
**Created:** [September 4, 2004, 8:07am UTC](https://forum.kirupa.com/t/how-to-pass-variables-to-attachmovie-syntax/63246 "2004-09-04T08:07:02Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![marc0047](https://avatars.discourse-cdn.com/v4/letter/m/ce73a5/32.png) [@marc0047](https://forum.kirupa.com/u/marc0047)\
**Post date:** [September 4, 2004, 8:07am UTC](https://forum.kirupa.com/t/how-to-pass-variables-to-attachmovie-syntax/63246/1 "2004-09-04T08:07:02Z")

</div>

I’m trying to create a function that can pass a variable to an attachMovie syntax. I’m doing this incorrectly, and I’m having difficulty looking for the right language to find out how to solve this problem. The movieclip that I am attaching is being exported with a “-m”, and so I thought I would use the syntax ‘variable + “-m”’, which is not working.

If anyone can point me to the right resource or has a simple answer for this, that would be great:

go (passThis);

function go (passer) {  
\_root.attachMovie(passer+"-m", passer, 1);  
}

Thanks.

---

<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:** [September 4, 2004, 8:33am UTC](https://forum.kirupa.com/t/how-to-pass-variables-to-attachmovie-syntax/63246/2 "2004-09-04T08:33:27Z")

</div>

the new instance name should be in quotes…  
so it goes…

\_root.attachMovie(passer+"-m", “passer”, 1);

---

<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:** [September 4, 2004, 10:27am UTC](https://forum.kirupa.com/t/how-to-pass-variables-to-attachmovie-syntax/63246/3 "2004-09-04T10:27:04Z")

</div>

Thanks, this is helpful. Is there by any chance a method in which I could pass the same variable name as the new instance name as well?

> [@SeaPink](#):
>
> the new instance name should be in quotes…  
> so it goes…
> 
> \_root.attachMovie(passer+“-m”, “passer”, 1);

---

<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:** [September 4, 2004, 10:33am UTC](https://forum.kirupa.com/t/how-to-pass-variables-to-attachmovie-syntax/63246/4 "2004-09-04T10:33:15Z")

</div>

i didn’t notice that u were trying to use the same variable as a new instance name…by the have you tried out your code…  
your code works perfectly fine:ne:

---

<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:** [September 4, 2004, 3:28pm UTC](https://forum.kirupa.com/t/how-to-pass-variables-to-attachmovie-syntax/63246/5 "2004-09-04T15:28:48Z")

</div>

I found my mistake: When I was passing the variable when I called the function, I did not put the variable in quotes.

I was doing this:

go(myclip);

instead of doing this:

go(“myclip”);

Thanks for replying. It was good to go through the motions.

> [@SeaPink](#):
>
> i didn’t notice that u were trying to use the same variable as a new instance name…by the have you tried out your code…  
> your code works perfectly fine:ne:
