Set button state

Hi, i’m making a website with mc used as button for the menu. I want that when i click on
a button he remain on “over” state, then when i click another button it come back to “up” state, and the new one to “over”, i can do this, but then i can’t assign single action to every button (like onRollOver, gotoAndPlay ecc…). here is my code, please help.
the button istance is pbtn0, pbtn1 and so on to 4.
I’m new to AS, i’ve found this code on this forum.

thanks so much


fncBtnBuild = function () {
// For each of 5…
for (var icrBtn = 0; icrBtn<5; icrBtn++) {
// Create a reference to a movieclip-button’s
// instance name (pbtn0 through pbtn4).
var rfcClip = this[“pbtn”+icrBtn];
// Assign the value of the for loop’s current
// incrementing variable to a variable (nbrID)
// in the scope of the movieclip-button itself
// (so it can be referred to later in the movieclip-
// button’s own event handler functions).
// Simultaneously assign the value of the for loop’s
// current incrementing variable to a unique variable
// for display by a textField within the movieclip-
// button (there are three of textfields in each
// movieclip-button and it’s easier to do it this
// way that to assign the value to three different
// textfield’s text property).
rfcClip.nbrID = rfcClip.stgBtnID=icrBtn;
// Create the onRelease button event handler function.
rfcClip.onRelease = function() {
// Disable this movieclip-button.
this.enabled = false;
// Send this movieclip-button to its frame
// showing the disabled state.
// Create a reference to the last previously clicked
// movieclip-button, based on the stored numeric ID.
var rfcLast = this._parent[“pbtn”+this._parent.nbrBtnLast];
// Enable the previously clicked movieclip-button.
rfcLast.enabled = true;
// Send the previously clicked movieclip-button
// to its normal UP frame.
// Assign this movieclip-button’s numeric ID to
// the variable in parent timeline to store it as
// the “previously clicked button” value.
this._parent.nbrBtnLast = this.nbrID;


// Run the function.