# Rollover state on button

**URL:** <https://forum.kirupa.com/t/rollover-state-on-button/292545>\
**Category:** Uncategorized\
**Created:** [July 15, 2009, 3:20pm UTC](https://forum.kirupa.com/t/rollover-state-on-button/292545 "2009-07-15T15:20:21Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jet71dl](https://avatars.discourse-cdn.com/v4/letter/j/8797f3/32.png) [@jet71dl](https://forum.kirupa.com/u/jet71dl)\
**Post date:** [July 15, 2009, 3:20pm UTC](https://forum.kirupa.com/t/rollover-state-on-button/292545/1 "2009-07-15T15:20:21Z")

</div>

Hello!

I am using the following code for a set of buttons that when one is clicked it deactivates the active button, if one is active:

```auto
var btns:Array = [btn1, btn2, btn3, btn4];

btn1.onRelease = btn2.onRelease = btn3.onRelease = btn4.onRelease = function(){
   activeBtn(this);   
}

function activeBtn(mc:MovieClip):Void{
   for(var i:Number=0; i<btns.length; i++){
      if(btns*!=mc){
         btns*.gotoAndStop("rest");
      }else{
         btns*.gotoAndStop("over");
      }
   }   
}

```

What I am looking to do is to add on to the code that I am already using which does part of what I want (when one button is active and you click on another button it ‘deactivates’ the currently active button so there is only one active button at a time…).

I just need to add a rollover effect to that code somehow so it wont cancel what it already does…

Any help would be greatly appreciated! Thanks.

Attached is a test file for anyone to look at.
