# Function -\> linking

**URL:** <https://forum.kirupa.com/t/function-linking/123894>\
**Category:** Uncategorized\
**Created:** [September 28, 2004, 10:03am UTC](https://forum.kirupa.com/t/function-linking/123894 "2004-09-28T10:03:44Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![amanuo](https://avatars.discourse-cdn.com/v4/letter/a/e99b99/32.png) [@amanuo](https://forum.kirupa.com/u/amanuo)\
**Post date:** [September 28, 2004, 10:03am UTC](https://forum.kirupa.com/t/function-linking/123894/1 "2004-09-28T10:03:44Z")

</div>

i have many buttons, that do practicly the same, except with a different target. Therefore i want to give them a function.  
So far the function is on the \_root. and the buttons ask for it like:

[color=blue]\_root.gonext(“zh”);[/color]

and the function on the root is:

[color=blue]function gonext(mc){[/color]  
[color=blue]targett = “p\_” + mc;[/color]  
[color=blue]targett.gotoAndStop(“whatever”);[/color]  
[color=blue]// plus a lot more[/color]  
[color=blue]}[/color]

So the mc called ‘p\_zh’ should gotoAndStop at “whatever”, but this doesnt work. AS reads the word targett as the target, not as a variable.

How do i let the function link back to the custom mc?
