# \[AS1/2\] passing an object as a variable in a function

**URL:** https://forum.kirupa.com/t/as1-2-passing-an-object-as-a-variable-in-a-function/50689
**Category:** flash
**Created:** [May 5, 2004, 3:23pm UTC](https://forum.kirupa.com/t/as1-2-passing-an-object-as-a-variable-in-a-function/50689 "2004-05-05T15:23:01Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![m00g](https://avatars.discourse-cdn.com/v4/letter/m/3bc359/32.png) [@m00g](https://forum.kirupa.com/u/m00g)
#### Post date: [May 5, 2004, 3:23pm UTC](https://forum.kirupa.com/t/as1-2-passing-an-object-as-a-variable-in-a-function/50689/1 "2004-05-05T15:23:01Z")

</div>

I have a movieClip prototype that calls another function once it has finished.  
The other function could be one of many.  
I want to be able to pass the variables of the second function to the first function:

```auto
MovieClip.prototype.func1=function(varA,varB,func2name,func2args){
// do something
// once done call second function:
this[func2Name](func2args.join(','));
};

```

// called using:

```auto
myMC.func1(varA,varB,"func2Name",{func2Arg1:value, func2Arg2:value})

```

Any idea how this should be written?  
At the moment only the first variable of func2 is populated…

Thanks for helpin me out on this 1 🙂

Ed
