# Passing a variable

**URL:** <https://forum.kirupa.com/t/passing-a-variable/259574>\
**Category:** Uncategorized\
**Created:** [May 6, 2008, 8:30pm UTC](https://forum.kirupa.com/t/passing-a-variable/259574 "2008-05-06T20:30:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![levidyllan](https://avatars.discourse-cdn.com/v4/letter/l/f08c70/32.png) [@levidyllan](https://forum.kirupa.com/u/levidyllan)\
**Post date:** [May 6, 2008, 8:30pm UTC](https://forum.kirupa.com/t/passing-a-variable/259574/1 "2008-05-06T20:30:00Z")

</div>

This is one of my probs that I would like to know…

I have a tween class as below and rather than repeat the same tween class for several itmes i have I would like to pass the name of the mc to a tween function but not having much success:  
heres what I would ideally want:

```auto
mcclip.onRollover = function(){
  tweenFunction("theMc.moveMc");
..some code
}

function tweenFunction(theMcID){
var mcName:String = theMcID;
var newYPos:Tween = new Tween(theMcID, "_x", Regular.easeOut, 0, 100, 3, true)
}

```

Now ideally I want 6 btns that will call just this one tween function and simply passing the name of the MC’s that I need to tween etc.

but also later on I would like to also pass in the start and end pos with variable as well so I can re-use the function for tweening etc.

But its giving errors etc.

I hope this made sense,and many thanks.  
Look out for my next tween issue.
