Button class?

so I am making a menu and I stumble across the notion of making a class to define these buttons instead of the following:


b1.onRollOver = over;
b1.onRollOut = out;
b1.b1_button_text.b1_text.text = "HOME";

b2.onRollOver = over;
b2.onRollOut = out;
b2.b1_button_text.b1_text.text = "PORTFOLIO";

b3.onRollOver = over;
b3.onRollOut = out;
b3.b1_button_text.b1_text.text = "RESUME";

b4.onRollOver = over;
b4.onRollOut = out;
b4.b1_button_text.b1_text.text = "CONTACT";

function over() {
	this.gotoAndPlay('b1_rollover');
}

function out() {
	this.gotoAndPlay('b1_rollout');
}

any idea how I do that?