# Code A Button

**URL:** <https://forum.kirupa.com/t/code-a-button/118519>\
**Category:** Uncategorized\
**Created:** [August 6, 2004, 7:44am UTC](https://forum.kirupa.com/t/code-a-button/118519 "2004-08-06T07:44:58Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sim085](https://avatars.discourse-cdn.com/v4/letter/s/dfb087/32.png) [@Sim085](https://forum.kirupa.com/u/Sim085)\
**Post date:** [August 6, 2004, 7:44am UTC](https://forum.kirupa.com/t/code-a-button/118519/1 "2004-08-06T07:44:58Z")

</div>

Hi, as many of you have noted I am giving a try on ActionScript 2.0 and I am trying to see how you can code a complete button that is that the button includes that on mouse over changes color, that on click it raises an event, etc… That means everything you can make to a button in a Flash Editor!!

Are there any ideas on how to do this, or any links?  
Thanks in advance.

---

<div class="post-metadata">

**Author:** ![Carixpig](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/carixpig/32/304_2.png) [@Carixpig](https://forum.kirupa.com/u/Carixpig)\
**Post date:** [August 6, 2004, 8:27am UTC](https://forum.kirupa.com/t/code-a-button/118519/2 "2004-08-06T08:27:23Z")

</div>

You actually have more freedom using movieClips instead of buttons. I’ve found that the same actions on a mc don’t work on a button.

You can do anything by using a movieClip as a button. Just so long as all actions are within some “on” handler.

The advantage of using a movieclip instead of a button is that buttons don’t support onLoad and onClipEvent, which are two of the most powerful event handlers in Flash.

---

<div class="post-metadata">

**Author:** ![Sim085](https://avatars.discourse-cdn.com/v4/letter/s/dfb087/32.png) [@Sim085](https://forum.kirupa.com/u/Sim085)\
**Post date:** [August 6, 2004, 9:27am UTC](https://forum.kirupa.com/t/code-a-button/118519/3 "2004-08-06T09:27:19Z")

</div>

However is it possible to draw (with ActionScript2.0) some objects on Frame 1 of the movie clip and other objects on Frame 2 of the movie?? and if yes how can this be done?

---

<div class="post-metadata">

**Author:** ![Carixpig](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/carixpig/32/304_2.png) [@Carixpig](https://forum.kirupa.com/u/Carixpig)\
**Post date:** [August 7, 2004, 11:23pm UTC](https://forum.kirupa.com/t/code-a-button/118519/4 "2004-08-07T23:23:08Z")

</div>

You might like to try to encapsulate all your actions in several functions in frame one. Then invoke each function as required.

Don’t quote me on this one, but I don’t believe you can call actions on frames other than the one you are stopped at (until you get there).

---

<div class="post-metadata">

**Author:** ![Sim085](https://avatars.discourse-cdn.com/v4/letter/s/dfb087/32.png) [@Sim085](https://forum.kirupa.com/u/Sim085)\
**Post date:** [August 9, 2004, 10:47pm UTC](https://forum.kirupa.com/t/code-a-button/118519/5 "2004-08-09T22:47:59Z")

</div>

[left]The problem is how to goto to the next frame. Since the command [font=Courier New]myMovie.gotoAndStop(2)[/font] don’t seem to work!![/left]

---

<div class="post-metadata">

**Author:** ![Dunga](https://avatars.discourse-cdn.com/v4/letter/d/e0b2c6/32.png) [@Dunga](https://forum.kirupa.com/u/Dunga)\
**Post date:** [August 10, 2004, 2:22am UTC](https://forum.kirupa.com/t/code-a-button/118519/6 "2004-08-10T02:22:33Z")

</div>

\_root.gotoAndStop(2) should work for the main timeline.

---

<div class="post-metadata">

**Author:** ![Sim085](https://avatars.discourse-cdn.com/v4/letter/s/dfb087/32.png) [@Sim085](https://forum.kirupa.com/u/Sim085)\
**Post date:** [August 10, 2004, 7:52am UTC](https://forum.kirupa.com/t/code-a-button/118519/7 "2004-08-10T07:52:51Z")

</div>

Just in case someone gets interested … what i did is I added two movies inside my btnOne movieClip, what I do is I play with the visibility of both movies when the user goes on the button!

However Thanks to all for your input  
I gues flash does not support that option!!

Thanks again 🙂

---

<div class="post-metadata">

**Author:** ![newhopekenny](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/newhopekenny/32/317_2.png) [@newhopekenny](https://forum.kirupa.com/u/newhopekenny)\
**Post date:** [August 10, 2004, 4:05pm UTC](https://forum.kirupa.com/t/code-a-button/118519/8 "2004-08-10T16:05:29Z")

</div>

If you check the helpfile, it has all the information you’d ever need on creating MCs that behave like buttons. Personally, I don’t think any serious flash developer should EVER use the button class.😉

---

<div class="post-metadata">

**Author:** ![Sim085](https://avatars.discourse-cdn.com/v4/letter/s/dfb087/32.png) [@Sim085](https://forum.kirupa.com/u/Sim085)\
**Post date:** [August 13, 2004, 1:14pm UTC](https://forum.kirupa.com/t/code-a-button/118519/9 "2004-08-13T13:14:19Z")

</div>

Were can I access this help file?

---

<div class="post-metadata">

**Author:** ![newhopekenny](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/newhopekenny/32/317_2.png) [@newhopekenny](https://forum.kirupa.com/u/newhopekenny)\
**Post date:** [August 13, 2004, 1:39pm UTC](https://forum.kirupa.com/t/code-a-button/118519/10 "2004-08-13T13:39:36Z")

</div>

It’s under “Help” near the top of the app…
