The Companion Site for the Book ActionScript 3.0 Game Programming University

 
About the Book
Book Source Files
Q&A Forum
Buy the Book
Book Table of Contents
Book Corrections
All Articles
Email Newsletter
Contact

Looking for examples of Flash games? Try the free Flash games at GameScene.com and the iPhone games at MacMost.com.
Book Corrections
Second Edition (Blue Cover)
Note that in CS5 on Windows, the ActionScript panel keyboard shortcut is simply F9, not Alt+F9. For Mac the shortcut remains Option+F9.

In chapter 4's Memory Game: There is a bug that will display the message "Game Over" if the player clicks on a light during the playback mode. This is because gameMode isn't being set to "play." You can fix that bug easily by adding the line gameMode = "play" right after // start timer in the nextTurn function:
// start timer
gameMode = "play";
lightTimer.start();

In chapter 5's Paddle Ball game: When publishing with Flash Player 9 settings, the game works fine. But if you switch to Flash Player 10 in the Publish Settings, then the ball first launches when you click the start button and doesn't wait for the player to click the screen. Flash Player 10 changed how even bubbling works slightly (read up on event bubbling in the docs). So when you click on the button, the click goes first to the button, and then to the stage. Which makes sense since the button is on the stage.
You can prevent this by putting this line in the clickStart function in the script that is on frame one of the movie:
event.stopPropagation();

In chapter 13, the endTurn function is printed twice. The second time it appears, it should be the drawComplete function instead. You can find the drawComplete function in the source files.


First Edition (Red Cover)

Flash CS4 Update: Flash CS4 uses AS3 as well, and almost all the code in the book should work in CS4. But it looks like there is one problem in chapter 10. The function showScore() seems to be conflicting with something in Flash CS4 of the same name. To fix, just change all occurrences of "showScore" to something like "showGameScore".

Chapter 10: Player can click on the right answer after they get one wrong.
The problem here lies in one line of code in the finishQuestion() function. The line should read:

answerSprites.getChildAt(i).removeEventListener(MouseEvent.CLICK,clickAnswer);

Notice the getChildAt(i) inserted. This matches the property changes in the rest of the function. It will properly turn off the answers as buttons. You'll need to do this for all the finishQuestion() functions in the various trivia games.

Chapter 2, Page 63: The line "var b:Number = .05;" shouldn't be there.

Chapter 3, Page 95: The section called "Adding Keyboard Listeners" should be titled "Adding Mouse Listeners."

Chapter 3, Page 103: The filename in bold should be "MatchingGame7.fla" not "MatchingGameObject7.fla".

Chapter 4, Page 131: The second time on the page in the code that "textMessage.selectable = false;" appears it should be "textScore.selectable = false;".

Chapter 5, Page 163: In the example file Airplane.as, this line is included right before the "// set up animation" comment.

this.gotoAndStop(Math.floor(Math.random()*5+1));

In the text on page 163, it is left out. The line simply chooses a random frame of the Airplane movie clip so one of five plane graphics can be displayed. The game works with or without it.

Chapter 6, page 213: In the clearPuzzle() function, the addEventListener should be removeEventListener.