# How to disable buttons

**URL:** <https://forum.kirupa.com/t/how-to-disable-buttons/2979>\
**Category:** Uncategorized\
**Created:** [February 20, 2002, 9:57pm UTC](https://forum.kirupa.com/t/how-to-disable-buttons/2979 "2002-02-20T21:57:49Z")\
**Posts on this page:** 7\
**Page:** 1

<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 20, 2002, 9:57pm UTC](https://forum.kirupa.com/t/how-to-disable-buttons/2979/1 "2002-02-20T21:57:49Z")

</div>

This is what I have, a main nav bar on level 0.\rI have loaded another swf. on level 1\rThen I have a swf on level 20, the user can still see the lower levels but I don’t wnt the user to press any of those buttons.\r\rIs there a way to disable the buttons on level 0 and level 1 when level 20 is showing?\r\rThanks,\rMatt\r

---

<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 21, 2002, 8:12pm UTC](https://forum.kirupa.com/t/how-to-disable-buttons/2979/2 "2002-02-21T20:12:12Z")

</div>

only way i could think of is use a var in your button actions; set it to true at beginning and to false with the clip loaded into level 20, and put an if var=true check before executing the actions; cursor will still change though…

---

<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, 2002, 4:31am UTC](https://forum.kirupa.com/t/how-to-disable-buttons/2979/3 "2002-02-22T04:31:53Z")

</div>

also, you could place the buttons inside movie clips, give those movie clips “instance” names, and then set the movie clip to \_visible=false when ever you needed them disabled. \_visible=true when you need the enabled.

---

<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, 2002, 3:59pm UTC](https://forum.kirupa.com/t/how-to-disable-buttons/2979/4 "2002-02-22T15:59:40Z")

</div>

Thanks for the suggestions. I guess there is no easy way of doing this.\r\rI have not worked with variables and if statements together do you know of a tut?\rI need the buttons visible but not active, thanks upuaut.\r\rThanks again.\rMatt

---

<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:** [September 24, 2004, 5:52am UTC](https://forum.kirupa.com/t/how-to-disable-buttons/2979/5 "2004-09-24T05:52:07Z")

</div>

I got this script from another forum. Try this one, that MOVIE on level 20, on the last frame, add this script:

\_parent.movieclip.buttonName.enabled = false;

I have tried the “enabled = true;” AS to some of my buttons and it worked.

---

<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:** [September 24, 2004, 6:36pm UTC](https://forum.kirupa.com/t/how-to-disable-buttons/2979/6 "2004-09-24T18:36:57Z")

</div>

I wrote something to make this idea rather easy for one project I was working on:

```auto

Button.prototype.disable = function() {
this.enabled = false;
this._alpha = 50;
}
Button.prototype.enable = function() {
this.enabled = true;
this._alpha = 100;
}

```

---

<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:** [September 28, 2004, 5:58am UTC](https://forum.kirupa.com/t/how-to-disable-buttons/2979/7 "2004-09-28T05:58:40Z")

</div>

the way i wrote a write around was to use alpha invisible buttons, and using the visibility of the button as a means to click on or not, (I was playing with easter egging the main menu during a binary preloader where the button was hidden until a key press was used, so this way the hand form didn’t change on mouseover. but the binary counter could then be bypassed after the onkey event.)
