
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
Onward!
|
37
Testing Our Quiz
Well, that’s it. Our quiz is finished. You can check whether the quiz works by using
Control
➝ Test Movie. Click on the answers in different combinations to see if your
quiz is keeping score correctly. You can even create a restart button that is available
throughout the quiz by making a button instance named
restart_btn (placed on its
own layer, on frame 1 of the main timeline), and adding the following code to frame
1 of the scripts layer:
restart_btn.onRelease = function ( ) {
this._parent.totalOutput_txt.removeTextField( );
this._parent.gotoAndStop("init");
}
Because totalCorrect is set to 0 in the code on the init frame, the score will reset
itself each time you send the playhead to
init.
If you find that your quiz isn’t working, try comparing it with the sample quiz pro-
vided at the online Code Depot.
Onward!
So how does it feel? You’ve learned a bunch of phrases, some grammar, some vocab-
ulary, and even had a drawn-out conversation with Flash (the multiple-choice quiz).
Quite a rich first day of language school, I’d say.
As you can see, there’s a lot to learn about ActionScript, but you can also do quite a
bit with just a little knowledge. Even the amount you know now will give you plenty
to play around with. Throughout the rest of this book, we’ll reinforce ...