Introduction to Flash and Actionscript


Step 1 - Create a game board

Step 2 - Create a Movie Clip with 3 frames ..... start frame, X frame, O Frame

Step 3 - Create 9 instances of the movie clip, one for each square. Name them appropriately, i.e. topleft_mc, topright_mc, etc

Step 4 - Create an event listener for each instance

Step 5 - Create a string variable to keep track of whose turn it is

Step 6 - Create a function to determine what to display (X or O) when the button is pressed

Step 7 - Make it so that you cannot press a square again......
HINT: Remove the Event Listener


Step 8 - Create variables to keep track of what is in each position so you can check for a win.

Or even better create an array and set each postion in the array



Step 9 - Set the value of the variable in Pressed functions




Step 10- Create a checkwin function or Create one function that checks all possibilities and call it each time.

Every time a button is pressed you will have to check for a win horizontally, vertically or on the diagonal. Use the strTL variables to check for this

Call the function everytime a button is pressed


Or use a loop if you created an array in Step 9

Step 11 - Show the winning path

Flash or change the color of the winning path.

Step 12 - Add a "Play Again" button

Step 13 - Keep track of the number of wins for X and O and display them on the screen

Add any other features you think would be useful.