# Movieclips and Buttons not working together

**URL:** <https://forum.kirupa.com/t/movieclips-and-buttons-not-working-together/289058>\
**Category:** flash\
**Created:** [May 25, 2009, 9:12pm UTC](https://forum.kirupa.com/t/movieclips-and-buttons-not-working-together/289058 "2009-05-25T21:12:01Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tyg3r](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/tyg3r/32/1341_2.png) [@Tyg3r](https://forum.kirupa.com/u/Tyg3r)\
**Post date:** [May 25, 2009, 9:12pm UTC](https://forum.kirupa.com/t/movieclips-and-buttons-not-working-together/289058/1 "2009-05-25T21:12:01Z")

</div>

[COLOR=#000000][FONT=verdana]Hi there,

I have 9 movieclips, and 9 buttons. (mc1, mc2, mc3… & btn1, btn2, btn3…)

I’d like it so that when you rollover the button, the corresponding movieclip begins an animation.

I thought I was on the right tracks here:

```auto

for (var i:int = 0; i < 8; i++) {
	this["btn"+i].addEventListener(MouseEvent.MOUSE_OVER, onButtonOver);
	this["btn"+i].addEventListener(MouseEvent.MOUSE_OUT, onButtonOut);
	this["btn"+i].addEventListener(MouseEvent.CLICK, onButtonClicked);
	this["btn"+i].buttonMode=true;
	this["btn"+i].mouseChildren=false;
	this["btn"+i].id=i;
}

function onButtonOver(e:MouseEvent):void {
	var movieclipVar="mc"+e.target.id;// this is what is meant to allow me to target a movieclip, rather than the original button.
	Tweener.addTween(movieclipVar, {x:100, time:0.5, transition:"easeOutBack"});
}

function onButtonOut(e:MouseEvent):void {
	Tweener.addTween(movieclipVar, {x:0, time:0.5, transition:"easeOutBack"});
}

function onButtonClicked(e:MouseEvent):void {
	movieclipVar.gotoAndStop(25);
}

```

I just can’t seem to direct a tween to a corresponding movieclip dynamically. Any help would be greatly appreciated.

Cheers.[/FONT][/COLOR]
