Attach an MC to another MC that resizes?

Hi there…

I have come across a small problem. I’m trying to acheive a similar effect to this websites navigation and layout: http://www.momkai.nl/

I have an MC(clip) which i am resizing using ActionScript. The moveclip only resizes horizontally. What i would like to do is attach a movieclip(menuClip) that contains my menu buttons to the right edge of the resizing movieclip.

When the buttons are clicked the MC resizes and new content is loaded in.

Heres my code so far.

On resizing ClipMC. This is actually inside another MC as I am using it to mask an image.

 onClipEvent (load) {
	this._width = 700;
	this._height = 500;
}
onClipEvent (enterFrame) {
	this._width += (_root.changeWidth-this._width)/7;
	this._height += (_root.changeHeight-this._height)/7;
} 

on last key frame of flash. Just changes the width of the clipMC
Code:

[left]stop();

_root.menuClip.button1.onRelease = function() {
	_root.changeWidth=185;
	_root.changeHeight=500;
};


_root.menuClip.button2.onRelease = function() {
	_root.changeWidth=285;
	_root.changeHeight=500;
};

_root.menuClip.button3.onRelease = function() {
	_root.changeWidth=500;
	_root.changeHeight=500;
};

_root.menuClip.button4.onRelease = function() {
	_root.changeWidth=350;
	_root.changeHeight=500;
};[/left]
   

What would i need to add to the menuClip MC to get it to “dock” to the right edge of my resizing MC.

I tried putting this on the menuClip MC:

[left]

onClipEvent (enterFrame) {
	this._x -= (_root.changeWidth-_root.clip._width)/7;
}

[/left]

but it doesnt really give me the desired result. The menu over shoots the clipMC

Any help would be much appreciated. I’ve attached the .fla file if someone would like to play around with it.

thanks in advance.

Rob