Flash and XML[c] A Developer[ap]s Guide
Now that we have a Question and four possible Answers, we need to formulate a few Responses: Lose and Win. Lose State
The Lose frame replaces the question on the Q layer with the message "Sorry, wrong" (Figure 1.9). The keyframe has a single line of ActionScript ”just Figure 1.9. The Lose Screen
ActionScript
stop(); This has the desired effect of keeping the player at this screen until he decides to move on. It is a trivial interaction; the player has no other choice and in fact is not penalized for making a bad choice ”yet. The Lose frame drops layers a1, a2, and a3 (three buttons ) and changes the text on the remaining button. More important, it also changes the button's Object Actions script. The new Object Action script has a goTo aimed at the Start frame (Figure 1.10). Figure 1.10. Programming the Try Again Button
Win State
Finally, the Win frame tells the player he won the round and presents a little explanatory text (Figure 1.11). Figure 1.11. The Win Screen
We have all the parts of a very primitive quiz round. Try it (C ONTROL /T EST M OVIE ). It moves ”but it feels dead. So far there is no scorekeeping, just the display of text. In fact, the player who gets here after three wrong guesses gets pretty much the same payoff as the player who knows the correct answer right away. |