# Hiding the "Next" Button AS3

**URL:** <https://forum.kirupa.com/t/hiding-the-next-button-as3/318517>\
**Category:** flash\
**Created:** [January 22, 2011, 4:13pm UTC](https://forum.kirupa.com/t/hiding-the-next-button-as3/318517 "2011-01-22T16:13:11Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![kirkyman0\_1](https://avatars.discourse-cdn.com/v4/letter/k/838e76/32.png) [@kirkyman0\_1](https://forum.kirupa.com/u/kirkyman0_1)\
**Post date:** [January 22, 2011, 4:13pm UTC](https://forum.kirupa.com/t/hiding-the-next-button-as3/318517/1 "2011-01-22T16:13:11Z")

</div>

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

```

}
