# On off button

**URL:** <https://forum.kirupa.com/t/on-off-button/14157>\
**Category:** flash\
**Created:** [February 22, 2003, 2:17pm UTC](https://forum.kirupa.com/t/on-off-button/14157 "2003-02-22T14:17:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![McFluff03](https://avatars.discourse-cdn.com/v4/letter/m/cab0a1/32.png) [@McFluff03](https://forum.kirupa.com/u/McFluff03)\
**Post date:** [February 22, 2003, 2:17pm UTC](https://forum.kirupa.com/t/on-off-button/14157/1 "2003-02-22T14:17:25Z")

</div>

Hi

I am trying to create a button that when pressed will make an movie clip visible and set it to a specific position on the screen. When this same button is pressed a second time the movie clip will become invisible. any ideas?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 22, 2003, 2:53pm UTC](https://forum.kirupa.com/t/on-off-button/14157/2 "2003-02-22T14:53:04Z")

</div>

on(Release) {  
if(\_root.mcInstanceName.\_visible==false) {  
\_root.mcInstanceName.\_visible=true  
} else {  
\_root.mcInstanceName.\_visible=false  
}  
}

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 22, 2003, 8:17pm UTC](https://forum.kirupa.com/t/on-off-button/14157/3 "2003-02-22T20:17:59Z")

</div>

I just wanted to add to Jsk’s code above, if you want it to be set to a certain cordinate on the stage then you’ll need to specify the x and y properties so the code would now look like this:

```php
on (release) {
	if (_root.mcInstanceName._visible == false) {
		_root.mcInstanceName._visible = true;
		_root.mcInstanceName._x = 50;
		_root.mcInstanceName._y = 50;
	} else {
		_root.mcInstanceName._visible = false;
	}
}

```

Just change the numbers to whatever you want. =)
