# Slideshow of movieClips in order!

**URL:** <https://forum.kirupa.com/t/slideshow-of-movieclips-in-order/260980>\
**Category:** Uncategorized\
**Created:** [May 21, 2008, 5:55pm UTC](https://forum.kirupa.com/t/slideshow-of-movieclips-in-order/260980 "2008-05-21T17:55:16Z")\
**Posts on this page:** 3\
**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 21, 2008, 5:55pm UTC](https://forum.kirupa.com/t/slideshow-of-movieclips-in-order/260980/1 "2008-05-21T17:55:16Z")

</div>

I created a slideshow of movieclips to auto show not in order. Now I need to create the same slideshow of movieclips but this time in order.

can someone please help me create this function?

Here is what I did for the random function

```auto

idleInterval = setInterval(attachRandom, 3000);

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());
}

```

please help out… thanks

---

<div class="post-metadata">

**Author:** ![Michael\_Chen](https://avatars.discourse-cdn.com/v4/letter/m/b5ac83/32.png) [@Michael\_Chen](https://forum.kirupa.com/u/Michael_Chen)\
**Post date:** [May 22, 2008, 12:26am UTC](https://forum.kirupa.com/t/slideshow-of-movieclips-in-order/260980/2 "2008-05-22T00:26:53Z")

</div>

Try this…

```auto

var inOrderCounter:Number = 0;
var mcArray:Array = new Array("Animation1", "Animation2", "Animation3", "Animation4");

// idleInterval = setInterval(attachRandom, 3000);
idleInterval = setInterval(attachInOrder, 3000);

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

function attachInOrder() {
    goAway();
    if(inOrderCounter >= mcArray.length) {
	inOrderCounter = 0;
    }
    var mc:MovieClip = _root.middleStage.attachMovie(mcArray[inOrderCounter], "Animation" + [inOrderCounter], _root.middleStage.getNextHighestDepth());
    inOrderCounter++;
}

```

---

<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 22, 2008, 7:12pm UTC](https://forum.kirupa.com/t/slideshow-of-movieclips-in-order/260980/3 "2008-05-22T19:12:49Z")

</div>

ok i got it working… but when i click on one of the buttons, the current movie clip doesn’t get remove. i tried \_root.middleStage.removeMovieClip(); but nothing will happen.  
advice please! :sen:

```auto

stop();

for (i=1; i<5; i++) {
 this["btn"+i].iD = i;
 this["btn"+i].onRelease = function() {
     goAway();
     clearInterval(idleInterval);
    _root.currentItem1.swapDepths(300);
      _root.currentItem1.removeMovieClip();
      _root.currentItem1 = _root.middleStage.attachMovie("content"+this.iD, "content"+this.iD, 1);
 };
}

var inOrderCounter:Number = 0;
var mcArray:Array = new Array("content1", "content2", "content3", "content4");

idleInterval = setInterval(attachInOrder, 3000);

function attachInOrder() {
    goAway();
    if(inOrderCounter >= mcArray.length) {
    inOrderCounter = 0;
    }
    var mc:MovieClip = _root.middleStage.attachMovie(mcArray[inOrderCounter], "content" + [inOrderCounter], _root.middleStage.swapDepths());
    inOrderCounter++;
}

function goAway() {
    _root.middleStage.removeMovieClip();
}

```
