Introduction to Flash and Actionscript

S4 - Buttons, Keyboard Commands, and HitTest

A1 - Moving and Resizing



Student Example

a) Move a Symbol up and down using arrow buttons


instancename.y -=5; //moves up

instancename.y +=5; //moves down

b) Add left and right buttons

c) Resize a Symbol

Use .width and .height


d) Rotate a Symbol

Use .rotation



Next and Previous (Cancelled)

To move to a specific scene we use (gotoAndPlay(1, "Scene 1")) where 1 is the frame and "Scene 1" is the scene.

a) Create at least 4 additional scenes in your Assignment 1. Each scene must include buttons that modify the scene in some way. The modifications should be different on each scene. (Changes alpha, colour, background, etc. be creative and try something different)

Add Next and Previous Buttons to change between scenes.

Also add a goto beginning and goto end option on each scene


b) Adding sound to a button

Add different sounds to your buttons

Step 1

Import your audio file into the library by selecting File > Import > Import to library then select your audio file and click ok.

Step 2

Create your button on the stage

Convert it into a symbol, then give your symbol an appropriate name and check the “button” button then click ok.

Step 3

Double click on your sound button and your timeline should look like below:

Now select the down state and create a new key frame by selecting F6.

Step 4

First add your sound file to the library.

With the down state selected go to the bottom of screen and choose your audio file from the library menu.