# prev\_btn & next\_btn

**URL:** <https://forum.kirupa.com/t/prev-btn-next-btn/296106>\
**Category:** flash\
**Created:** [September 9, 2009, 4:34pm UTC](https://forum.kirupa.com/t/prev-btn-next-btn/296106 "2009-09-09T16:34:12Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![phingko](https://avatars.discourse-cdn.com/v4/letter/p/e5b9ba/32.png) [@phingko](https://forum.kirupa.com/u/phingko)\
**Post date:** [September 9, 2009, 4:34pm UTC](https://forum.kirupa.com/t/prev-btn-next-btn/296106/1 "2009-09-09T16:34:12Z")

</div>

Guys, I’m stuck with this code  
I want to make a simple next and back button for an instruction page

so far this is what I have

back2\_btn.alpha = 0;  
back2\_btn.mouseEnabled = false;

back2\_btn.addEventListener(MouseEvent.CLICK,controlHandler);  
next\_btn.addEventListener(MouseEvent.CLICK,controlHandler);

function controlHandler(evt:MouseEvent):void {  
switch (evt.target) {  
case back2\_btn :  
prevFrame();  
next\_btn.mouseEnabled = true;  
next\_btn.alpha = 1;  
if(currentFrame == 1) {  
//if it is frame 1, disable previous button  
back2\_btn.mouseEnabled = false;  
//dim the button by making it transparent  
}  
break;  
case next\_btn :  
gotoAndPlay(currentFrame + 21);  
back2\_btn.mouseEnabled = true;  
back2\_btn.alpha = 1;  
if(currentFrame == 103) {  
next\_btn.mouseEnabled = false;  
next\_btn.alpha = 0;  
break;  
}  
}  
}

actually i prefer to do it using labels but i was expected to do it effectively,lesser code,lesser size,etc

can anyone tell me what’s wrong with the code?
