AS2 - Rearrange Array - reposition movie clips

Hi there,

Im using zOrder - swapdepths array manipulation file.

Import movie clips into array. close movie button works fine. what i want to do is shift everything below closed button to eliminate the gap. I tried to reposition that with loop and use of ._y = but I am sure i messed it up. I pasted code below. Anyone have idea how to sort it out? Thanks


// zOrder.fla by Nathan ****en - [email protected] (or) nk****[email protected]
// to be used for educational purposes only :)
// this is a new version - sorry for the latest "buggy" one
// ..........................................................

// create new array for monitoring z-order
zOrderList = new Array("0");

defaultX = 100;
defaultY = 100;
increment = 25;
id = 0

// create a new windowObj...
function windowObj (title, content) {

    //  get the current depth based on the array
    var depth = id;
    trace("id: "+id);

    //  create 
    _root.attachMovie("window", "window"+id, id);
    this.window = _root["window"+id];

    //  position
    this.window._y = defaultY+((id-1)*increment);

    // set data
    this.window.title = title;
    this.window.content = content;
    this.window.myID = id;
    this.window.myDepth = zOrderList.length;



// delete windowObj and splice zOrderList...
function closeWindow (incomingDepth) {

    _root["window" + zOrderList[incomingDepth]].removeMovieClip();
    zOrderList.splice(incomingDepth, 1);

    for (i=incomingDepth; i<zOrderList.length; i++) {
        // change each windowObj's depth
        _root["window"+zOrderList*].myDepth-- ;


I uploaded FLA file as well here:

Any help appreciated