Hiding the "Next" Button AS3

Hi Apologies if this has been discussed before.

I have a small microsite built using Flash 4. It contains 5 ‘pages’ assigned to individual keyframes, each keyframe separated by 5 frames (F5s). I have a navigation bar for the entire site which includes NEXT and PREVIOUS buttons. When the user reaches the LAST PAGE/KEYFRAME I do not want the NEXT BUTTON to show. I suspect it is something simple like nextbutton.visible = true - but I’ve spent a day trying to work out how to do this but without success.

I am using AS3 and the existing coding is shown below. Any help much much appreciated.

Thanks George :*(

nextbutton.addEventListener(MouseEvent.CLICK, nextPage);
previousbutton.addEventListener(MouseEvent.CLICK, prevPage);

function nextPage(event:MouseEvent):void {

var thisLabel:String = MovieClip(root).currentLabel; 
var thisLabelNum:String = thisLabel.replace("page", ""); 
var curNumber:Number = Number(thisLabelNum); 
if (curNumber < 5) {
    
    var nextNum:Number = curNumber + 1; 
    MovieClip(root).gotoAndStop("page" + nextNum); 
    
}

}
function prevPage(event:MouseEvent):void {

var thisLabel:String = MovieClip(root).currentLabel; 
var thisLabelNum:String = thisLabel.replace("page", ""); 
var curNumber:Number = Number(thisLabelNum); 
var prevNum:Number = curNumber - 1; 
MovieClip(root).gotoAndStop("page" + prevNum); 

}