Static buttons, dynamic actions?

Okay, I have 10 buttons named b0, b1, b2…b9 on the main timeline. In the first frame I have this AS:


getButtons = function () {
	for (i=0; i<=9; i++) {
		but = "b"+i;
	}
	but.onPress = function() {
		trace(this._name);
	};
};

Why doesn’t this work?