# Need help passing movieclip name to function

**URL:** <https://forum.kirupa.com/t/need-help-passing-movieclip-name-to-function/225496>\
**Category:** flash\
**Created:** [May 12, 2007, 6:21pm UTC](https://forum.kirupa.com/t/need-help-passing-movieclip-name-to-function/225496 "2007-05-12T18:21:07Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![milo56279](https://avatars.discourse-cdn.com/v4/letter/m/e9c0ed/32.png) [@milo56279](https://forum.kirupa.com/u/milo56279)\
**Post date:** [May 12, 2007, 6:21pm UTC](https://forum.kirupa.com/t/need-help-passing-movieclip-name-to-function/225496/1 "2007-05-12T18:21:07Z")

</div>

Here is the code that I have right now (it obviousvly doesn’t do what I want it to):

```auto
#include "lmc_tween.as"

orig_x = mc_01.black_bkg._x;
orig_y = mc_01.black_bkg._y;

function buttonIn() {
	mc_01.btn_txt.alphaTo(100, 1.25, "easeOutBounce");
	mc_01.black_bkg.tween(["_xscale","_yscale"],[100,150], 1.25, "easeOutBounce");
	mc_01.black_bkg.slideTo(orig_x, orig_y-5, 1.25, "easeOutBounce");
}

function buttonOut() {
	mc_01.btn_txt.alphaTo(0, 1.25, "easeOutBounce");
	mc_01.black_bkg.scaleTo(100, 1.25, "easeOutBounce");
	mc_01.black_bkg.slideTo(orig, orig_y, 1.25, "easeOutBounce");
}

mc_01.btn.onRollOver = buttonIn;
mc_01.btn.onRollOut = buttonOut;

mc_02.btn.onRollOver = buttonIn;
mc_02.btn.onRollOut = buttonOut;

mc_03.btn.onRollOver = buttonIn;
mc_03.btn.onRollOut = buttonOut;

```

What I want to be able to do is pass the name of the movie clip (ie mc\_01, mc\_02…) to the function, and have the function effect that particular movie clip. I had this code that didn’t work:

```auto
#include "lmc_tween.as"

orig_x = mc_01.black_bkg._x;
orig_y = mc_01.black_bkg._y;

function buttonIn(clipName) {
	clipName.btn_txt.alphaTo(100, 1.25, "easeOutBounce");
	clipName.black_bkg.tween(["_xscale","_yscale"],[100,150], 1.25, "easeOutBounce");
	clipName.black_bkg.slideTo(orig_x, orig_y-5, 1.25, "easeOutBounce");
}

function buttonOut(clipName) {
	clipName.btn_txt.alphaTo(0, 1.25, "easeOutBounce");
	clipName.black_bkg.scaleTo(100, 1.25, "easeOutBounce");
	clipName.black_bkg.slideTo(orig, orig_y, 1.25, "easeOutBounce");
}

mc_01.btn.onRollOver = buttonIn("mc_01");
mc_01.btn.onRollOut = buttonOut("mc_01");
mc_02.btn.onRollOver = buttonIn("mc_02");
mc_02.btn.onRollOut = buttonOut("mc_02");
mc_03.btn.onRollOver = buttonIn("mc_03");
mc_03.btn.onRollOut = buttonOut("mc_03");

```

Thank you in advance,  
Milo
