# Move MC to set Array Positions

**URL:** https://forum.kirupa.com/t/move-mc-to-set-array-positions/261476
**Category:** flash
**Created:** [May 28, 2008, 12:35am UTC](https://forum.kirupa.com/t/move-mc-to-set-array-positions/261476 "2008-05-28T00:35:51Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![james182](https://avatars.discourse-cdn.com/v4/letter/j/278dde/32.png) [@james182](https://forum.kirupa.com/u/james182)
#### Post date: [May 28, 2008, 12:35am UTC](https://forum.kirupa.com/t/move-mc-to-set-array-positions/261476/1 "2008-05-28T00:35:51Z")

</div>

ok i am trying to get my movieclips to start in one position, show in another, and hide in the last.

And in order 0, 1, 2, 3, 4, etc, but at the moment its 1, 0, 7, 6, 5, 4, etc.

```php
// ----+ SETTINGS +---- //
var sites = 8;
//var baseDepth = _root.getNextHighestDepth();
// ----++---- //

var settings = new Array();
settings.push({_alpha:0, _x:510});
settings.push({_alpha:100, _x:200});
settings.push({_alpha:0, _x:-200});

function setup() {
    for (i=0; i<sites; i++) {
        this["step_"+i].pos = i;
        tween(this["step_"+i],"_x",this["step_"+i]._x,settings[this["step_"+i].pos]._x);
        tween(this["step_"+i],"_alpha",this["step_"+i]._alpha,settings[this["step_"+i].pos]._alpha);
        trace(this["step_"+i]);
        trace(this["step_"+i].pos = i);
        trace("------------------------------");
    }
}
setup();

function animate() {
    for (i=0; i<sites; i++) {
        this["step_"+i].pos = this["step_"+i].pos == 7 ? 0 : this["step_"+i].pos+1;
        //this["step_"+i].swapDepths(baseDepth+(this["step_"+i].pos));
        tween(this["step_"+i],"_x",this["step_"+i]._x,settings[this["step_"+i].pos]._x);
        tween(this["step_"+i],"_alpha",this["step_"+i]._alpha,settings[this["step_"+i].pos]._alpha);
    }
}
function animateBack() {
    for (i=0; i<sites; i++) {
        this["step_"+i].pos = this["step_"+i].pos == 0 ? 7 : this["step_"+i].pos-1;
        //this["step_"+i].swapDepths(baseDepth+(this["step_"+i].pos));
        tween(this["step_"+i],"_x",this["step_"+i]._x,settings[this["step_"+i].pos]._x);
        tween(this["step_"+i],"_alpha",this["step_"+i]._alpha,settings[this["step_"+i].pos]._alpha);
    }
}

nextBtn.onRelease = function() {
    animate();
};
prevBtn.onRelease = function() {
    animateBack();
};

function tween(mc, prop, begin, end) {
    var easeType = mx.transitions.easing.Strong.easeOut;
    var time = 50;
    var _tween = new mx.transitions.Tween(mc, prop, easeType, begin, end, time);
    _tween.onMotionFinished = function() {
    };
}

```
