# Loading movieclips in chronological order

**URL:** <https://forum.kirupa.com/t/loading-movieclips-in-chronological-order/260902>\
**Category:** Uncategorized\
**Created:** [May 20, 2008, 10:17pm UTC](https://forum.kirupa.com/t/loading-movieclips-in-chronological-order/260902 "2008-05-20T22:17:19Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![lolomedia](https://avatars.discourse-cdn.com/v4/letter/l/ebca7d/32.png) [@lolomedia](https://forum.kirupa.com/u/lolomedia)\
**Post date:** [May 20, 2008, 10:17pm UTC](https://forum.kirupa.com/t/loading-movieclips-in-chronological-order/260902/1 "2008-05-20T22:17:19Z")

</div>

I did it randomly before… here is what i had

```auto

function attachRandom() {
    goAway();
    var mcArray:Array = new Array("Animation1", "Animation2", "Animation3", "Animation4", "Animation5", "Animation6");
    var ranMc:Number = Math.floor(Math.random() * mcArray.length);
    var mc:MovieClip = _root.middleStage.attachMovie(mcArray[ranMc], "Animation" + [ranMc], _root.middleStage.getNextHighestDepth());
}

```

this is attaching Animation1, Animation2, etc from the library to stage.

help please :stare:

---

<div class="post-metadata">

**Author:** ![reactor88](https://avatars.discourse-cdn.com/v4/letter/r/b4bc9f/32.png) [@reactor88](https://forum.kirupa.com/u/reactor88)\
**Post date:** [May 20, 2008, 11:34pm UTC](https://forum.kirupa.com/t/loading-movieclips-in-chronological-order/260902/2 "2008-05-20T23:34:12Z")

</div>

I’m probably not the best guy to answer this, but couldn’t you get rid of your ranMC variable and use some sort of loop based on the length of your array, using the array value (since it goes in order 0,1,2…) to identify the clip you’re loading?
