[F8] Dock menu question

i am trying to make a dock menu like in mac osx computers. but i’ve run into a problem. i have 4 boxes on stage… when a box scales up, the other boxes move aside. i got them to move right when the box before them scales up. but i don’t know how to make them move left when the box after them scales up. i hope that made sense… i want them to move left when the box next to them scales up.
[COLOR="#ff0000"]swf movie[/COLOR]
here is the code:

var boxes:Array = [box1, box2, box3, box4];
var i:Number = 1;
//scale
MovieClip.prototype.dock = function(minScale, maxScale)
{
	var x2:Number = _root._xmouse;
	var x1:Number = this._x;
	var distanceX;
	distanceX = (Math.sqrt(Math.pow(x2 - x1, 2))) / 4;
	this._width = this._height = 70 - (distanceX);
	if (this._xscale < 15)
	{
		this._xscale = this._yscale = minScale;
	}
	if (this._xscale > 43)
	{
		this._xscale = this._yscale = maxScale;
	}           
};
//---intervals
//move to right when previous box scales up
MovieClip.prototype.intervalR = function()
{
	var distR:Number;
	distR = boxes[i - 1]._x + boxes[i - 1]._width + 5;
	boxes*._x = distR;
};
this.onEnterFrame = function()
{
	for (i = 0; i < boxes.length; i++)
	{
		boxes*.dock(15, 43);
		boxes*.intervalR();
	}
};

i tried adding a intervalL() prototype to do the opposite of intervalR() prototype, but when i add that, the boxes just “run away” when my mouse pointer gets close…


//move to left when next box scales up
MovieClip.prototype.intervalL = function()
{
	var distL:Number;
	distL = boxes[i + 1]._x - boxes[i + 1]._width - 5;
	boxes*._x = distL;
};
this.onEnterFrame = function()
{
	for (i = 0; i < boxes.length; i++)
	{
		boxes*.dock(15, 43);
		boxes*.intervalR();
		boxes*.intervalL();
	}
};

[COLOR=“Red”]here is the swf with prototype intervalL();[/COLOR]

any help is greatly appreciated. thanks in advance :slight_smile: