Flash tutorial: creating a simple button with Flash ActionScript 3.0

Today : How to create a simple button in Flash with AS3.

Example

Sources

You can find the .fla and with the ActionScript source code inside.

Download the source code here: Simple_button_benoitfreslon.com.fla

Let’s start

  1. Open Flash > Create a new Flash ActionScript 3.0 document
  2. Insert > New Symbol
  3. Name : Btn
  4. Type > Button
  5. Click OK

Capture d’écran 2013-09-28 à 16.10.09

  1. Draw a button in the Up state (when the button is released)
  2. Draw a different button in the Over  state (when the mouse cursor is over the button)
  3. Daw a different button in the Down state (when the button is pressed)
  4. Draw a simple shape in the Hit state (The Hit area of the button)
  5. It’s done. Back to the stage now.

Capture d’écran 2013-09-28 à 16.18.25

  1. Then select the MovieClip on the stage
  2. Set an instance name “mc_btn” in the Properties pannel like this

simple_button_02

  1. Create a new Layer with this name: Actions
  2. Select this new layer
  3. Open the Actions Pannel: Windows > Actions or hit F9

simple_button_03

Copy and paste this code:

Leave a Comment