Help With Width Size For Button Slider

I have created a slider that moves under a said button when pressed, however I need the slider to resize when under that button relative to the button width.

So each button is given the instance name but incremented by one each time
but1, but2 but3 upto but 12

and here is the action script where am I going wrong

stop();
MovieClip.prototype.ease = function(tar) {
	clearInterval(id);
	this.onEnterFrame = function() {
		this._x = tar-(tar-this._x)/1.2;
		if (Math.abs(tar-this._x)<1) {
			this._x = tar;
			delete this.onEnterFrame;
		}
	};
};
var pos = but1._x;
for (var i = 1; i<12; i++) {
	var btn = this[&quot;but&quot;+i];
	btn.id = i;
	btn.onRollOver = function() {
		slider.ease(this._x);
		trace(&quot;x = &quot; + this._x);
		trace(&quot;w = &quot; + this._width);
	};
	btn.onRollOut = function() {
		id = setInterval(slider, &quot;ease&quot;, 250, pos);
	};
	btn.onRelease = function() {
		pos = this._x;
		setButtons(this.id);
	};
}
	function setButtons(q) {
	for (var i = 1; i<12; i++) {
		var btn = this[&quot;but&quot;+i];
		if (i != q) {
			btn.enabled = 1;
			btn.gotoAndStop(1);
		} else {
			btn.enabled = 0;
			btn.gotoAndStop(2);
		}
	}
}
setButtons(1);