Can't quite see what I'm doing

hi,

I need  to restore the original values of the boxes ids on the  mouseDown event to resume the image swap on button press.  I can't understand the traced values. Only the first time, setInterval calls the swapImages function which is what the variables should be like from a start.




I'd appreciatte an orientation as to how to approach this







stop();

_parent.loading_function(id);

var count:Number = 1;

function swapIds():Void {
trace(“this boxes’s ID is equal to…” + id);
count++;

    if(count == 5){
        id = 4;
    } else if (count == 4){
        id = 3;
    } else if(count == 3){
        id = 2;
    } else if(count == 2){
        id = 1;
    } else if(count == 1){
        id = 5;
    }
    
    _parent.box1.targetBox.attachMovie("image - "+count, "image - "+count, getNextHighestDepth());
    _parent["box"+count].targetBox.attachMovie("image - "+id, "image - "+id, getNextHighestDepth());
    
    _parent.box1.boxMask._width = _parent.box1.targetBox._width;
    _parent.box1.boxMask._height = _parent.box1.targetBox._height;
    _parent.box1.boxOutline._width = _parent.box1.targetBox._width;
    _parent.box1.boxOutline._height = _parent.box1.targetBox._height;
    
if(count == 5){
    clearInterval(interval_id);
}

var mouseListener:Object = new Object();
mouseListener.onMouseDown = function () {
    clearInterval(interval_id);
    Mouse.removeListener(mouseListener);
    delete count;
    };
    
Mouse.addListener(mouseListener);

}

var interval_id:Number = setInterval(swapIds, 1000);