Variables in class files

Hello,
First of all, I’m sorry for posting so many dissimilar things. All of this stuff has me quite confused.

Anyway, I have a class file where I am trying to dynamically assign variables to a series of buttons. My end goal is to set up a smart navigation menu. ( Click a button & it stays highlighted…Click another button and the first button shuts off. etc. etc. )

It’s kicking out a bunch of errors and I don’t understand any of them. I believe I do not fully understand how variables ( public or private ) work in a class file?..among other things…I’m tryin though…

Any help would be greatly appreciated…

package classfiles{
 import flash.display.MovieClip;
 import flash.events.MouseEvent;
///////////////////////////
 public class menu1 extends MovieClip{
  
  public var current;
  public var button1;
  public var button2;
  
  
  public function menu1(){
   trace("Document Class Init");
   
   
   button1.buttonMode = true;
   button2.buttonMode = true;
   
   button1.addEventListener(MouseEvent.CLICK, clickButton);
   button1.addEventListener(MouseEvent.MOUSE_OVER, overButton);
   button1.addEventListener(MouseEvent.MOUSE_OUT, outButton);
   button2.addEventListener(MouseEvent.CLICK, clickButton2);
   button2.addEventListener(MouseEvent.MOUSE_OVER, overButton2);
   button2.addEventListener(MouseEvent.MOUSE_OUT, outButton2);
   
   }
   
public function firstbutton(){
 if (current != button1) {
  current=button1;
  trace("button 1 is on");
};
firstbutton();
// BUTTON ONE 
public function clickButton(event:MouseEvent):void {
 if (current != button1) {
  trace("button 1 is on");
  current=button1;
 }
}
public function overButton(event:MouseEvent):void {
 if (current != button1) {
  trace("button 1 is over");
 }
}
public function outButton(event:MouseEvent):void {
 if (current != button1) {
  trace("button 1 is out");
 }
}
// BUTTON 2
public function clickButton2(event:MouseEvent):void {
 if (current != button2) {
  trace("button 2 is on");
  current=button2;
 }
}
public function overButton2(event:MouseEvent):void {
 if (current != button2) {
  trace("button 2 is over");
 }
}
public function outButton2(event:MouseEvent):void {
 if (current != button2) {
  trace("button 2 is out");
 }
}

    
////////////////////////////
  }
 }
}