Setting boundaries on array objects with random speed and _x position

Hi. I have created a panning movie, with an array of objects dropped on top, using AS to set a different random scroll speed and initial _x position for each object within the array. What I want is to avoid the inevitable overlap that occurs, where one object scrolls across in front of another, effectively hiding it from view. Is there a way to get these array objects to communicate with one another, and set a left and right boundary on each object, so that no other array object will ever cover another? Here’s my AS, attached to an empty clip positioned top left on the stage - the arrays themselves are defined in a frame action:


onClipEvent(load) {
// add all the objects at random, from -X to X
for(i=0;i<_root.objectsArray.length;i++) {

    object = this.attachMovie(_root.objectsArray*, "object_" + i, 200 + i);
    object._y = Math.random()* (_root.stageHeight - object._height);
    object._x = ( Math.random()* (2 * _root.foregroundWidth) ) - _root.foregroundWidth;
    
// set a depth for parallax effect

    object._xscale = object._yscale = _root.minScale + (Math.random() * (_root.maxScale - _root.minScale) );
    object.swapDepths(Math.floor(object._xscale));
}

for(p=0;p&lt;_root.peopleArray.length;p++) {
    
    person = this.attachMovie(_root.peopleArray[p], "person_" + p, 300 + p);
    person._y = (_root.stageHeight - person._height);
    person._x = ( Math.random()* (2 * _root.foregroundWidth) ) - _root.foregroundWidth;
    
}

}

onClipEvent(enterFrame) {
// move each object at a rate relative to their parallax
for(i=0;i<_root.objectsArray.length;i++) {

        object = eval("this.object_" + i);
        object._x += (_root.xVelocity + _root.xVelocity * ((object._xscale - _root.minScale)/_root.maxScale));
    
    
        if (object._x &gt; _root.foregroundWidth) {
            object._x = 0 - Math.random() * _root.foregroundWidth;
            object._y = Math.random()* (_root.stageHeight - object._height);
        } else if (object._x &lt; 0 - _root.foregroundWidth) {
            object._x = _root.stageWidth + Math.random() * (_root.foregroundWidth - _root.stageWidth);
            object._y = Math.random()* (_root.stageHeight - object._height);

        }
    }
// if the object is beyond x or -x, send it off stage, somewhere random

for(p=0;p&lt;_root.peopleArray.length;p++) {
        person = eval("this.person_" + p);
        person._x += (_root.xVelocity + _root.xVelocity * ((object._xscale - _root.minScale)/_root.maxScale));
    
        if (person._x &gt; _root.foregroundWidth) {
            person._x = 0 - Math.random() * _root.foregroundWidth;
        } else if (person._x &lt; 0 - _root.foregroundWidth) {
            person._x = _root.stageWidth + Math.random() * (_root.foregroundWidth - _root.stageWidth);
        }
}

}


Thanks for any ideas. I’m not allowed to show you the .swf…but I’ve concluded that a visual reference is paramount in asking for help in finding a solution. So - here’s a link:

http://deliver.capstrat.com/development/capstrat/banner/index.html

Thanks again!