Advanced Buttons for Flash

There is a 'Button' symbol you can use in Flash to trigger various events. A button can consist of up to 4 frames which correspond with Up, Over and Down states plus one additional frame to specify Hit area.

But what if we want to add more animation to our button? One way is to create movie clips with animation and place them within the four frames. However, letting a movie clip behave like a button brings many advantages when additonal scripting needs to be involved.


EXAMPLE BUTTON:




Download the source code >

How it works

First, create a movie clip with animation of all states. Label the frames which correspond with beginning of each state.

Place an empty button inside the movie clip so that the hit area (specify it e.g. by drawing a rectangle in the 'Hit' frame) covers the area of the movie clip.

Assign event handlers. E.g. to determine what to do when mouse is over the button:
on (rollOver) {
   if (_root.link != 3) {
      this.gotoAndPlay("s1");
   }
}