# Button switch's light on/off

**URL:** <https://forum.kirupa.com/t/button-switchs-light-on-off/95008>\
**Category:** Uncategorized\
**Created:** [November 19, 2003, 11:08am UTC](https://forum.kirupa.com/t/button-switchs-light-on-off/95008 "2003-11-19T11:08:34Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![rathod\_bina](https://avatars.discourse-cdn.com/v4/letter/r/ce73a5/32.png) [@rathod\_bina](https://forum.kirupa.com/u/rathod_bina)\
**Post date:** [November 19, 2003, 11:08am UTC](https://forum.kirupa.com/t/button-switchs-light-on-off/95008/1 "2003-11-19T11:08:34Z")

</div>

Hi there!!  
Im really new to Flash n Actionscript and have been dropped in to make a switch that will make a light come on in the first click and off on the second, on on the third and off on the forth etc… etc…

i have created the switch as a button and the light on/off as two movie clips…  
what coding would i be looking to add to make this switch work…

previously i have been given this… but its not working :puzzle:  
//this is for the button (switch)  
on(release) {  
if (\_root.light\_on:active == 1) {  
setProperty("\_root.light on", \_visible, “1”);  
\_root.light\_on:active = “0”;  
} else {  
\_root.light\_on:active = “1”;  
setProperty("\_root.light\_on", \_visible, “0”);  
}  
}

//this is for the light on  
onClipEvent (load) {  
active = “1”;  
setProperty("\_root.light\_on", \_visible, “0”);  
}

hope u can help… much appreciated in advance
