# Accessing Different movieClips In An Array?

**URL:** <https://forum.kirupa.com/t/accessing-different-movieclips-in-an-array/306405>\
**Category:** flash\
**Created:** [March 14, 2010, 9:09pm UTC](https://forum.kirupa.com/t/accessing-different-movieclips-in-an-array/306405 "2010-03-14T21:09:14Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alimation](https://avatars.discourse-cdn.com/v4/letter/a/839c29/32.png) [@Alimation](https://forum.kirupa.com/u/Alimation)\
**Post date:** [March 14, 2010, 9:09pm UTC](https://forum.kirupa.com/t/accessing-different-movieclips-in-an-array/306405/1 "2010-03-14T21:09:14Z")

</div>

Hi everybody,

I’m having problems making a loop of different movieClips. I’ve been able to find info about duplicating the same movieClip but I can’t seem to get it to apply to this. This is what I am working with:

I have 13 different movieClips of an animated character. They are titled montyDog\_mc, montyBear\_mc, montyCat\_mc, etc…  
I also have a next and a previous button. What I need to happen is for the movieClip animations to cycle through, one at a time, each time the user clicks the next or previous button.

I think I should be creating an array of some sort but I am very confused about how I list the movie clips in an array and apply it to the button.

This is what I have:

montyArray = new Array();  
montyBear[0] = “montyBear\_mc”;  
montyBee[1] = “montyBee\_mc”;  
montyCow[2] = “montyCow\_mc”;  
montyDog[3] = “montyDog\_mc”;  
montyDuck[4] = “montyDuck\_mc”;  
montyFish[5] = “montyFish\_mc”;  
montyFox[6] = “montyFox\_mc”;  
montyGoat[7] = “montyGoat\_mc”;  
montyGoose[8] = “montyGoose\_mc”;  
montyHorse[9] = “montyHorse\_mc”;  
montyLion[10] = “montyLion\_mc”;  
montyPig[11] = “montyPig\_mc”;  
montyRat[12] = “montyRat\_mc”;  
montySheep[13] = “montySheep\_mc”;

for(var i=0; i\<montyArray.length; i++){  
trace (montyArray\*);  
}  
// NEXT AND PREVIOUS BUTTONS--------------------------------

// Next  
next\_mc.onRollOver = function() {  
this.gotoAndPlay(“2”);  
};  
next\_mc.onRollOut = function() {  
this.gotoAndPlay(“1”);  
};  
next\_mc.onPress = function() {  
this.gotoAndPlay(“3”);  
};  
next\_mc.onRelease = function() {  
this.gotoAndPlay(“2”);  
trace (montyArray\*);  
this.\_parent.holder\_mc.attachMovie(“montyMain\_mc”,“montyMain2\_mc”,1);  
};

Am I targeting the movieClips properly? Any kind of help would be greatly appreciated.
