# Button Down State to Stay Active onRelease?

**URL:** <https://forum.kirupa.com/t/button-down-state-to-stay-active-onrelease/11003>\
**Category:** flash\
**Created:** [January 10, 2003, 3:32pm UTC](https://forum.kirupa.com/t/button-down-state-to-stay-active-onrelease/11003 "2003-01-10T15:32:01Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Scottie](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/scottie/32/72_2.png) [@Scottie](https://forum.kirupa.com/u/Scottie)\
**Post date:** [January 10, 2003, 3:32pm UTC](https://forum.kirupa.com/t/button-down-state-to-stay-active-onrelease/11003/1 "2003-01-10T15:32:01Z")

</div>

Hello everyone. What is the simplest way to make a button’s down state stay active when the user presses it? I found out how to do it with movie clips with the following AS:

movieClip.onRollOver = function () {  
gotoAndStop(“over”);  
};

movieClip.onPress = function () {  
gotoAndStop(“down”);  
};

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

…but I want to keep the items as buttons. Thanks again.

Scottie

---

<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:** [January 10, 2003, 3:38pm UTC](https://forum.kirupa.com/t/button-down-state-to-stay-active-onrelease/11003/2 "2003-01-10T15:38:00Z")

</div>

Well, exactly the same. You can give instance names to buttons too (but it’s much more practical to use movie clips all the time).

pom 🙂

---

<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:** [January 10, 2003, 8:40pm UTC](https://forum.kirupa.com/t/button-down-state-to-stay-active-onrelease/11003/3 "2003-01-10T20:40:26Z")

</div>

Instead of “movieClip.onRelease” do I state “button.onRelease”? (Don’t have access to Flash right now).

Scottie

---

<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:** [January 10, 2003, 9:07pm UTC](https://forum.kirupa.com/t/button-down-state-to-stay-active-onrelease/11003/4 "2003-01-10T21:07:53Z")

</div>

Well, yeah. If your button’s instance name is _myButton_, then you whould write

```auto
myButton.onRollOver=function(){};

```

pom :hair:

---

<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:** [January 15, 2003, 4:09am UTC](https://forum.kirupa.com/t/button-down-state-to-stay-active-onrelease/11003/5 "2003-01-15T04:09:00Z")

</div>

Re: my original question, where do I place the mc code? I created an MC called “RSVP\_mc”. Inside the “RSVP\_mc” movie clip timeline I’ve created 4 frames, labeled respectively up, over, down and hit, placing the appropriate graphic on each frame. Also, each frame has a stop() action. Then, back on the mc itself on the main timeline I’ve added the following AS:

onClipEvent (load) {  
RSVP\_mc.onRollOver = function() {  
this.gotoAndStop(“over”);  
};  
RSVP\_mc.onPress = function() {  
this.gotoAndStop(“down”);  
};  
RSVP\_mc.onRelease = function() {  
this.gotoAndStop(“hit”);  
};  
}

Nothing happens. Am I putting things in the right place? Also, I’d like it to load a .swf into an empty MC on the stage once clicked. What script do I add at the end, and where? I await your genius…

\*\<:) Scottie

How about this… Is there a way to add some AS to a basic button to make it “stick” in the down state? That would be so much easier!
