# Button stay in down state?

**URL:** <https://forum.kirupa.com/t/button-stay-in-down-state/120493>\
**Category:** Uncategorized\
**Created:** [August 24, 2004, 11:06pm UTC](https://forum.kirupa.com/t/button-stay-in-down-state/120493 "2004-08-24T23:06:20Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![dante2010](https://avatars.discourse-cdn.com/v4/letter/d/cdc98d/32.png) [@dante2010](https://forum.kirupa.com/u/dante2010)\
**Post date:** [August 24, 2004, 11:06pm UTC](https://forum.kirupa.com/t/button-stay-in-down-state/120493/1 "2004-08-24T23:06:20Z")

</div>

Hi,

I was wondering if it’s possible to have a button stay in the down state when a user clicks on it?

I’ve read that this is usually accomplished by replacing the button with a movie clip, but I’d rather not do that if possible as I’m on a deadline which is fast approaching.

So far I have a button with all states set with a gfx. I have named the but “but2”. I have placed the following code in a new layer, in the same frame as the button.

but2.onRelease = function () {  
gotoAndStop(“hit”);  
};

I read that this should make the button stay in the hit state on release. Only problem is it doesn’t seem to work!

---

<div class="post-metadata">

**Author:** ![Prophet](https://avatars.discourse-cdn.com/v4/letter/p/838e76/32.png) [@Prophet](https://forum.kirupa.com/u/Prophet)\
**Post date:** [August 24, 2004, 11:51pm UTC](https://forum.kirupa.com/t/button-stay-in-down-state/120493/2 "2004-08-24T23:51:54Z")

</div>

on your up state, make your graphic a movie clip with 4 frames, one your original up state and the third and fourth with your down state graphics…  
on frame 1 you want this AS

```auto
if(but2Down){
gotoAndPlay(2)
}

```

frame 2 have this:

```auto
gotoAndPlay(1)

```

frame 3 have

```auto
if(!but2Down){
gotoAndPlay(1)
}

```

frame 4 have this:

```auto
gotoAndPlay(3)

```

on your button add this on press or on release:

```auto
if(but2.but2Down){
but2.but2Down--
}
else{
but2.but2Down++
}

```

note im not entirely sure on the pathing there… if i were u id name ur up state mc as _but2_ as wel… just in case 😉

will take u bout 5 mins at most all in all and should give you the effect you want 🙂

Prophet.

---

<div class="post-metadata">

**Author:** ![999](https://avatars.discourse-cdn.com/v4/letter/9/c5a1d2/32.png) [@999](https://forum.kirupa.com/u/999)\
**Post date:** [August 25, 2004, 12:10am UTC](https://forum.kirupa.com/t/button-stay-in-down-state/120493/3 "2004-08-25T00:10:30Z")

</div>

Why even use a button? Just use a movie clip and have it stop at a selected frame.

---

<div class="post-metadata">

**Author:** ![dante2010](https://avatars.discourse-cdn.com/v4/letter/d/cdc98d/32.png) [@dante2010](https://forum.kirupa.com/u/dante2010)\
**Post date:** [August 25, 2004, 12:56am UTC](https://forum.kirupa.com/t/button-stay-in-down-state/120493/4 "2004-08-25T00:56:45Z")

</div>

Thanks! That helped alot!

---

<div class="post-metadata">

**Author:** ![Prophet](https://avatars.discourse-cdn.com/v4/letter/p/838e76/32.png) [@Prophet](https://forum.kirupa.com/u/Prophet)\
**Post date:** [August 25, 2004, 6:05pm UTC](https://forum.kirupa.com/t/button-stay-in-down-state/120493/5 "2004-08-25T18:05:20Z")

</div>

> [@dante2010](#):
>
> I’ve read that this is usually accomplished by replacing the button with a movie clip, but I’d rather not do that if possible as I’m on a deadline which is fast approaching.

@ditchhopper: thats why 😉

Prophet.
