# Button state

**URL:** <https://forum.kirupa.com/t/button-state/29386>\
**Category:** flash\
**Created:** [August 26, 2003, 10:01am UTC](https://forum.kirupa.com/t/button-state/29386 "2003-08-26T10:01:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![something369](https://avatars.discourse-cdn.com/v4/letter/s/7ea924/32.png) [@something369](https://forum.kirupa.com/u/something369)\
**Post date:** [August 26, 2003, 10:01am UTC](https://forum.kirupa.com/t/button-state/29386/1 "2003-08-26T10:01:15Z")

</div>

Hi, I barely know anything about actionscript and could use help with the following.

I’ve set up this action at the top of my movie in its own layer that extends for my whole movie. If someone changes the variable buttonpress in the movie to a value of 1 I want the sate of my button named “buttsukh” to change to the over state. I’ve labled the frame for the over state “\_over” in the button frames. Yet, when buttonpress does = 1 the button state does not change. Can you help?

Actionscript…

if (\_root.buttonpress==1)  
{  
\_root.buttsukh.gotoandplay("\_over");  
}  
…

Thanx for your time.

---

<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:** [August 26, 2003, 10:04am UTC](https://forum.kirupa.com/t/button-state/29386/2 "2003-08-26T10:04:46Z")

</div>

I don’t think you can target the over state of a button. Instead, make the button a movieclip that has two frames. Frame 1 represents the up state and frame two the over state. Then use

[AS]  
if (\_root.buttonpress==1)  
{  
\_root.buttsukh.gotoAndStop(2);  
}  
[/AS]

---

<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:** [August 26, 2003, 8:18pm UTC](https://forum.kirupa.com/t/button-state/29386/3 "2003-08-26T20:18:05Z")

</div>

You’re a genius.
