# Make a button?

**URL:** https://forum.kirupa.com/t/make-a-button/266179
**Category:** Uncategorized
**Created:** [July 17, 2008, 1:34am UTC](https://forum.kirupa.com/t/make-a-button/266179 "2008-07-17T01:34:27Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![yuzhan618](https://avatars.discourse-cdn.com/v4/letter/y/8dc957/32.png) [@yuzhan618](https://forum.kirupa.com/u/yuzhan618)
#### Post date: [July 17, 2008, 1:34am UTC](https://forum.kirupa.com/t/make-a-button/266179/1 "2008-07-17T01:34:27Z")

</div>

i need a gray button, once i click on it, change to blue, click again, change back to gray.

so i have two frames and the instant name:showerhead1\_mc

the problem is, it change from gray to blue when click on it, but couldn’t change from blue to gray when click on it again.

this is the code:

stop();  
var i:int= 1;

showerhead1\_mc.addEventListener(MouseEvent.CLICK,onClick);  
function onClick(event:MouseEvent): void  
{if (i==1)  
{  
gotoAndStop(2);  
}

else  
{  
gotoAndStop(1);  
}  
}
