# Using mc vars in function?

**URL:** <https://forum.kirupa.com/t/using-mc-vars-in-function/28685>\
**Category:** Uncategorized\
**Created:** [August 16, 2003, 10:16pm UTC](https://forum.kirupa.com/t/using-mc-vars-in-function/28685 "2003-08-16T22:16:36Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![blackpulp](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/blackpulp/32/81_2.png) [@blackpulp](https://forum.kirupa.com/u/blackpulp)\
**Post date:** [August 16, 2003, 10:16pm UTC](https://forum.kirupa.com/t/using-mc-vars-in-function/28685/1 "2003-08-16T22:16:36Z")

</div>

ok, first of all, im not totally sure how to describe my problem so im going to recreate a simple example of what im trying to do…

my problem is that im not sure how to refer to a dynamic mc in a function…i know that sounds confusing but maybe this will help…

lets say i have a function like:

fakeFunction = function (mcName){  
// refer to the dynamically targeted mc  
\_root.mcName.\_x = 123;  
}

the problem with this is that the function looks for an mc titled “mcName”…and the function is hard coded…what i want to do…is to reuse this function with any movieClip on the timeline i want…so how do i refer to the mc in the function dynamically? i hope this makes sense?

ive also tried something like this

\_root[mcName]\_x = 123;

but this doesnt work either…ive seen something like this done before…using brackets to target an mc with a var…

any help would be much appreciated…

blessings.

---

<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:** [August 16, 2003, 10:27pm UTC](https://forum.kirupa.com/t/using-mc-vars-in-function/28685/2 "2003-08-16T22:27:42Z")

</div>

take a look at this  
[http://www.kirupaforum.com/forums/showthread.php?s=&threadid=12082](http://www.kirupaforum.com/forums/showthread.php?s=&threadid=12082)  
it should help
