Introduction to Flash and Actionscript

Programming Basics

S4 - Using Buttons, Keyboard, and HitTest


Tutorial 1 - Creating a Basic Button

Tutorial 2 - Start Stop Buttons (Cancelled - use for reference)

Assignment 1 -Modifying Objects

Assignment 2 - Pacman Menu Screen

(Tutorial )/Assignment 3- Keyboard Commands

Assignment 4- Event Listeners and Moving Enemies

Tutorial 3 - Drag and Drop (Cancelled- use for reference)

(Tutorial)/Assignment 5 - Collisions
















Assignment 6 - Pacman Collisions

Delete the dots when pacman hits them.

End the game when pacman hits a ghost. (You will need to have the last ghost event listener call the first)






Quit will Only work when the game has been compiled not in Testing Mode


Above and Beyond

For both of these you will need to use a variable. See next section! Hints below but I will not solve this for you. (That is why it is above and beyond)

ICS3C students only need to do 1 of the items below. Bonus if you do both. Also I will help if you need an explanation.

1. Add a scoring system

Use a printScore function to initialize score and print it in a text box

// Initialize score variable

var intScore:int;
intScore = o

On your dots hittests add one to the score

// to add to score

score +=1;


To exit a a certain score put an if condition in the printScore function

// add an if to your printScore function

remove the event listener
call your endScreen function


2. Hittest your walls in you hittest function, so that pacman cannot travel through them.

if (pacman_mc.hitTestObjec(wall1_mc))

hit = true


else if (pacman_mc.hitTestObjec(wall2_mc))

hit = true


// Keep going for all your walls

// last condition is an else if no wall is hit



hit = false



At the start of your program initialize hit

var hit:Boolean;


In the KeyDown Function modify your controls for hit true, or hit false

if (hit == false)


// All your normal commands


if (hit == true)


// move in opposite direction (incease number slightly)





Embed all tutorials, assignments, and code.

Attach your .swf files

Link to your .fla files

Copy the Evaluation Sheet to your google drive and post the link at the top of your webpage.