# How to give actions to MC Button?

**URL:** <https://forum.kirupa.com/t/how-to-give-actions-to-mc-button/184115>\
**Category:** flash\
**Created:** [April 2, 2006, 3:28am UTC](https://forum.kirupa.com/t/how-to-give-actions-to-mc-button/184115 "2006-04-02T03:28:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hosen](https://avatars.discourse-cdn.com/v4/letter/h/bb73d2/32.png) [@Hosen](https://forum.kirupa.com/u/Hosen)\
**Post date:** [April 2, 2006, 3:28am UTC](https://forum.kirupa.com/t/how-to-give-actions-to-mc-button/184115/1 "2006-04-02T03:28:43Z")

</div>

Hello, I would like to know how to give an action to a Movie Clip Button.  
Right now the movieclip is an instance named “button\_mc”, and I wrote this code in the main timeline.

stop();  
this.button\_mc.onRollOver = function() {  
button\_mc.gotoAndPlay("\_over");  
};  
this.button\_mc.onRollOut = function() {  
button\_mc.gotoAndPlay("\_out");  
};

This script is only for onrollover and rollout events.  
It works, but I don’t know what script to add (and where) for the “button” to react to the tipical “on(release)” action.  
If someone can help me, would be greaaaat!!

---

<div class="post-metadata">

**Author:** ![TheCanadian](https://avatars.discourse-cdn.com/v4/letter/t/67e7ee/32.png) [@TheCanadian](https://forum.kirupa.com/u/TheCanadian)\
**Post date:** [April 2, 2006, 3:38am UTC](https://forum.kirupa.com/t/how-to-give-actions-to-mc-button/184115/2 "2006-04-02T03:38:02Z")

</div>

For starters all of that code is redundant since Flash will automatically go to frames labeled _\_up_, _\_over_ and _\_down_ when the respective event is called. To have a function called when the movie clip is pressed, use this code:

```auto
button_mc.onPress = function():Void {
 trace("onPress");
};

```

Hope this helps :mountie:

---

<div class="post-metadata">

**Author:** ![prasanth\_arasu](https://avatars.discourse-cdn.com/v4/letter/p/e9a140/32.png) [@prasanth\_arasu](https://forum.kirupa.com/u/prasanth_arasu)\
**Post date:** [April 2, 2006, 7:11am UTC](https://forum.kirupa.com/t/how-to-give-actions-to-mc-button/184115/3 "2006-04-02T07:11:47Z")

</div>

you can give like this

button\_mc.onRelease=function()  
{  
\_root.button\_mc.gotoAndPlay("\_over");  
};

i hope this helps u

---

<div class="post-metadata">

**Author:** ![Coldfinger](https://avatars.discourse-cdn.com/v4/letter/c/a5b964/32.png) [@Coldfinger](https://forum.kirupa.com/u/Coldfinger)\
**Post date:** [April 3, 2006, 5:11am UTC](https://forum.kirupa.com/t/how-to-give-actions-to-mc-button/184115/4 "2006-04-03T05:11:07Z")

</div>

Yep. I had this problem a few days ago and using “\_root” worked.
