Simple button is making me crazy

Hey I have been doing a bit of AS3 for a few years now, but still consider myself as an amateur, haven’t really used it to anything else than making a few presentation pages for myself.
My problem is I have 4 keyframes. where the 2 first ones is for 2 different menus and the 3rd. and 4th is 1 gallery which loads different stuff whether you’re on frame 3 or 4.
To each gallery is a button that needs to send the user back to frame 2, The button is linked into the gallery, but needs to have something different written on it depending on whether you’re in the frame 3 or frame 4.

so far I’ve got to this:

The button on the mainstage is a movieclip and is called: back_btn
On the first frame inside “back_btn” is the following AS:

textbtn.text = MovieClip(parent).buttonText;
stop();

the AS on frame 3 is the following:


//relates to gallery
var galleryWidth:uint = 900;
var galleryHeight:uint = 500
var galleryX:Number = 195;
var galleryY:Number = 250;
var galleryScale:Number = 1.1;
var galleryTweenSpeed:Number = 0.4;
var galleryScrollSpeed:uint = 30;
var galleryxmlURL:String = "xml/rabitsketch.xml"
var galleryAlignLeft:Boolean=false;
var galleryOffsetX:Number = 255
var galleryOffsetY:Number = 220

//back Button
back_btn.addEventListener(MouseEvent.MOUSE_OVER, buttonRollOver);
back_btn.addEventListener(MouseEvent.MOUSE_OUT, buttonRollOut);
back_btn.addEventListener(MouseEvent.CLICK, buttonClick); 

function buttonRollOut(event:MouseEvent):void{
    back_btn.gotoAndStop("off");
    var buttonText = "this is gallery1";
}

function buttonRollOver(event:MouseEvent):void{
    back_btn.gotoAndStop("over");
}

function buttonClick(event:MouseEvent):void{
    back_btn.gotoAndStop("click");
    gotoAndStop("frontpage2");

In frame4 is the following AS:


// relates to gallery2
galleryWidth = 900;
galleryHeight = 500;
galleryX = 195;
galleryY = 250;
galleryScale = 1.1;
galleryTweenSpeed = 0.4;
galleryScrollSpeed = 20;
galleryxmlURL = "xml/rabitsketch2.xml"

galleryAlignLeft = false;
galleryOffsetX = 255; 
galleryOffsetY = 220;

// Back Button2
back_btn.addEventListener(MouseEvent.MOUSE_OVER, buttonRollOver2);
back_btn.addEventListener(MouseEvent.MOUSE_OUT, buttonRollOut2);
back_btn.addEventListener(MouseEvent.CLICK, buttonClick2); 

function buttonRollOut2(event:MouseEvent):void{
    back_btn.gotoAndStop("off");
    var buttonText = "this is gallery2";
}

function buttonRollOver2(event:MouseEvent):void{
    back_btn.gotoAndStop("over");
}

function buttonClick2(event:MouseEvent):void{
    back_btn.gotoAndStop("click");
    gotoAndStop("frontpage2");
}


It seems to work fine until I access one of the galleries and the following error occeurs:

TypeError: Error #2007: Parameter text must be non-null.
    at flash.text::TextField/set text()
    at having2galleriestesttext_fla::namebutton_17/frame1()[having2galleriestesttext_fla.namebutton_17::frame1:5]
    at flash.display::Sprite/constructChildren()
    at flash.display::Sprite()
    at flash.display::MovieClip()
    at having2galleriestesttext_fla::gallerytotal_12()
    at flash.display::MovieClip/gotoAndStop()
    at having2galleriestesttext_fla::MainTimeline/clickHandler_frontpage()[having2galleriestesttext_fla.MainTimeline::frame1:51]

Where “frame 1:5” is the this code from inside the back_btn
textbtn.text = MovieClip(parent).buttonText;

and “frame 1:51” is:
gotoAndStop(“gallery1”);
which is just piece of a button on frame one that sends you to frame3

finally when I push the back button the following error comes:

TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at having2galleriestesttext_fla::MainTimeline/buttonRollOut()[having2galleriestesttext_fla.MainTimeline::frame3:24]

where “frame 3:24” is the following:
back_btn.gotoAndStop(“off”);
which is a piece of my buttonRollOut function.

I know this seems like a lot of errors, but I litterally don’t know what to do, since everything was working perfectly until I started trying to have my button showing 2 different names depending on what keyframe you are at. The gallery and everything is doing what it’s supposed to except me getting errors in the output window.