# Controlling multiple movie clips

**URL:** <https://forum.kirupa.com/t/controlling-multiple-movie-clips/5015>\
**Category:** Uncategorized\
**Created:** [August 28, 2002, 11:41pm UTC](https://forum.kirupa.com/t/controlling-multiple-movie-clips/5015 "2002-08-28T23:41:06Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![exactpixel](https://avatars.discourse-cdn.com/v4/letter/e/edb3f5/32.png) [@exactpixel](https://forum.kirupa.com/u/exactpixel)\
**Post date:** [August 28, 2002, 11:41pm UTC](https://forum.kirupa.com/t/controlling-multiple-movie-clips/5015/1 "2002-08-28T23:41:06Z")

</div>

I’ve been trying to figure out how to control five(forever growing) different movie clips with the same script. i used to just duplicate the script and change the instance names but that will not work this time. does any one know a way to set up your script?  
here’s the code:

back\_btn.onRollOver = function() {  
first\_mc.onEnterFrame = function() {  
this.prevFrame();  
}  
}  
back\_btn.onRollOut = back\_btn.onReleaseOutside = function() {  
delete first\_mc.onEnterFrame;  
first\_mc.stop();

i need a second\_mc and a third\_mc (ect.) added to this

in theory this should work but does not:

first\_mc.onEnterFrame = second\_mc.onEnterFrame = function()

---

<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 29, 2002, 12:00am UTC](https://forum.kirupa.com/t/controlling-multiple-movie-clips/5015/2 "2002-08-29T00:00:39Z")

</div>

Instead of naming your movie clips ‘first\_mc’, ‘second\_mc’ and so on, but instead name them ‘mc\_1’, ‘mc\_2’ and so on and use this script:

```auto
[color=royal blue]function[/color] your_function(your_instance) {
	back_btn.[color=royal blue]onRollOver[/color] = [color=royal blue]function[/color]() {
	your_instance.[color=royal blue]onEnterFrame[/color] = [color=royal blue]function[/color]() {
	[color=royal blue]this[/color].[color=royal blue]prevFrame[/color]();
	}
	}
	back_btn.[color=royal blue]onRollOut[/color] = back_btn.[color=royal blue]onReleaseOutside[/color] = [color=royal blue]function[/color]() {
	[color=royal blue]delete[/color] your_instance.[color=royal blue]onEnterFrame[/color];
	your_instance.[color=royal blue]stop[/color]();
	}
}

*//Change the [color=red]5[/color] to the number of movie clips.*
[color=royal blue]for[/color](i=1; i <= [color=red]5[/color]; i++) {
	your_function([color=light blue]"mc_"[/color] + i);
}

```

---

<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 29, 2002, 1:19am UTC](https://forum.kirupa.com/t/controlling-multiple-movie-clips/5015/3 "2002-08-29T01:19:52Z")

</div>

hmmmnnn… it doesn’t work. I tried it but the script doesn’t work at all now. I’m not sure if i am going about it the right way or what exactly i 'm doing wrong. confused

---

<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 29, 2002, 4:03am UTC](https://forum.kirupa.com/t/controlling-multiple-movie-clips/5015/4 "2002-08-29T04:03:54Z")

</div>

post a .zip file with the .fla inside and ill take a look at it
