Doh! maths problem! fix my code!

okay ive been trying to make a rounded button that expands and collapses. have been trying for the last 2 days! a long time for one freaky button!

my button works like this - there is a middle bit that gets bigger and smaller and 2 rounded bits either side that should ‘glue’ to the middle bit.

Im attaching my fla for y’all to see whats going on but this is the code I have on my left rounded bit –

onClipEvent (enterFrame) {
_root.combo = this._x+_root.center._width;
this._x = _root.center._width-(_root.center._width*2 +_root.combo);
}

now _root.combo is EXACTLY what should be added at the end there but BEFORE its added!! the problem is it relies on x and if you add it to x, x gets bigger and therfore so does _root.combo!

if the code is as follows then _root.combo is what it should be

onClipEvent (enterFrame) {
_root.combo = this._x+_root.center._width;
this._x = _root.center._width-(_root.center._width*2 + whatever);
}

In an ideal world there would be some way to put _root.combo in a protected environment.

In my attached fla ive used the number 170 instead of _root.combo so you can see whats happening. the important code is in the left rounded thing (its gray) and the button is triggered by clicking on the red box.

Alternatively if someone could come up with a simple way of doing things that works that would be cool too.

thanks anyone that wants to help…