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). Each Keyframe is labelled ‘page1’ through to ‘page5’. 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 ::confused:

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);

}

nextButton._visible = false;

Hi

Tried that but it didn’t work. I’ve rejigged the AS3 and the design a bit and finally got it to work.

Thanks anyway.

George

What AS did you end up using to hide the button, if the above didn’t work?