# 5 buttons instead of 3?

**URL:** <https://forum.kirupa.com/t/5-buttons-instead-of-3/148384>\
**Category:** Uncategorized\
**Created:** [May 19, 2005, 1:56pm UTC](https://forum.kirupa.com/t/5-buttons-instead-of-3/148384 "2005-05-19T13:56:47Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![bennymartensson](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/bennymartensson/32/1317_2.png) [@bennymartensson](https://forum.kirupa.com/u/bennymartensson)\
**Post date:** [May 19, 2005, 1:56pm UTC](https://forum.kirupa.com/t/5-buttons-instead-of-3/148384/1 "2005-05-19T13:56:47Z")

</div>

[sorry for the cross post, wrong forum the first time…]

This code works fine with 3 buttons. But what to do if I have more than 3 buttons, let’s say 5 of 'em?

// code begins

\_root.picnumber=0;

this.btn1.onRelease = function () {  
if (\_root.picnumber == 2) {  
pic2.gotoAndPlay (12);  
} else if (\_root.picnumber == 3) {  
pic3.gotoAndPlay (12);  
}  
\_root.picnumber = 1;  
pic1.gotoAndPlay (2);  
}

this.btn2.onRelease = function () {  
if (\_root.picnumber == 1) {  
pic1.gotoAndPlay (12);  
} else if (\_root.picnumber == 3) {  
pic3.gotoAndPlay (12);  
}  
\_root.picnumber = 2;  
pic2.gotoAndPlay (2);  
}

this.btn3.onRelease = function () {  
if (\_root.picnumber == 2) {  
pic2.gotoAndPlay (12);  
} else if (\_root.picnumber == 1) {  
pic1.gotoAndPlay (12);  
}  
\_root.picnumber = 3;  
pic3.gotoAndPlay (2);  
}
