Make MC Button from a MovieClip

March 20th, 2007 by Slav

There are several ways to create buttons in Flash.  Some people will create a button class, where they’ll define all the methods for rollovers , active and disabled states and associate it with the particular MovieClip symbol in the library. The other will create a Button instance and place the graphics on the timeline under frames with labels “over”, “down” etc.

Not everybody is aware though, you can make any ordinary MovieClip to behave like Button type of symbol (i.e. going automatically to differently labeled frames depending on the mouse events). All needed is following :

  1. Your movie clip must have specifically named frame labels : “_up”,”_over”,”_down”,”_hit”
  2. Your movie clip must have some methods defined for it, such as onRollOver, onRelease ..etc.

I have written this extension to automate the process of creating the frames, label names and adding stop frames for it.

So how do you create a button with this extension ?

1. Install the extension

2. Create empty document.

3. Create a rectangle that you want to use as your button.

4. Press F8 to turn it into a MovieClip. Name the instance “test_btn”

5. Select Commands > [Slav] Make MC Button from the main menu.

Make MC Button Screenshot

you can select the second frame (over state) and change the color of the rectangle, to see how it changes color on rollOver…

6. Select the frame , open the actionscript panel and write a mouse handler such as :

test_btn.onRelease =  function (){
getURL("http://www.durej.com");
}

7. Test the movie.

Of course you can use the classes to define buttons actions, as well as use more sophisticated ways to show rollovers, such as to have filters applied on particular frames, or replace graphics with animation.

Download Extension

Posted in AS2, JSFL

2 Responses

  1. Sandro Bilbeisi

    Very nice extension !

    ..but does not install on Flash CS 3 / Mac
    could you distribute the source for a manual install ?

  2. Slav

    comments have been disapbled, due to the spamming..