ࡱ> Root Entryp|YrRASHfALDXContents+"Page 1J&Symbol 1 %&'(*,-./0BCDEFGHILMPRRoot Entryp|YrRASH vZDXContents5"Page 1J&Symbol 1 !"#$)12346789:;<=>?@AJKNOQCPicPage CPicLayer CPicFrameCPicText {$W|@ TextField2 Arialpa flash quiz  TS$X@Arial(welcome back to the flash quiz. in version 3 of the quiz, we use arrays to store both the user's answers and the correct answers for each question. by using arrays, we make our code more succinct, legible, and easier to extend if we want to add new questions. w @Arialpversion 3 (for flash mx) 8+)@_sans(? CPicShape %Y4X$%%%Y4X%%$22h'&h'&0ـhـ0h  $%Y4X$%%%Y4X%%hـ0hh'&h'&0ـ l 5h'&h'&0ـhـ0h΀%Y4X$%%%Y4X%%$@ 000308@ 3v0003@0&AP3?H housingOO CPicButton d` choice1_btn dj choice2_btnR Rd~ choice3_btn?SW ?-B choice buttons H @Arialq.1  !@ Arialpversion 1  !@ Arialpversion 2  \!@ Arialpversion 3 # @Arial:: ,hArialwhen were movie clips introduced into flash? ?T?6 question 1O ?f  H @Arialq.2 A @Arial:: *hArialwhen was mp3 audio support added to flash?  !@ Arialpversion 3  !@ Arialpversion 4  \!@ Arialpversion 5 ?y ?u question 2OO?WF  q y@Arialpthank you for taking the quiz ?I, quiz endOO ?inita< ?q2/ ?quizEndil labelsO?(//-------------------------------------------------------- // Multiple Choice Quiz, By Colin Moock // Functions and Arrays Version, for Flash MX // For the accompanying tutorial, see Chapters 9 and 11 of // 'ActionScript for Flash MX: The Definitive Guide' //-------------------------------------------------------- // Stop the movie at the first question. stop(); // =================== // INIT QUIZ VARIABLES // =================== // Store a reference to the timeline that contains the quiz user interface. var quizTimeline = this; // Create an array to contain user's answers. var userAnswers = new Array(); // Create an array to contain each question's correct answer. var correctAnswers = [3, 2]; // Create a convenience variable to store the number of // questions in the quiz. var numQuestions = correctAnswers.length; // ===================== // CREATE QUIZ FUNCTIONS // ===================== // Function: answer() // Desc: Registers the user's answers to quiz questions and // advances the quiz through its questions. // Params: choice The user's answer for the current question. function answer (choice) { // Add the current answer to the list of user answers. userAnswers.push(choice); // Create a convenient variable to store the number // of the current question. var currentQuestion = userAnswers.length; // Display the question and answer in the Output window for debugging. trace("Question " + currentQuestion + ". The user answered: " + userAnswers[currentQuestion-1] + "."); // If we're on the last question... if (currentQuestion == numQuestions) { // ...go to the quiz end frame. quizTimeline.gotoAndStop("quizEnd"); // And grade the user. gradeUser(); } else { // ...otherwise, go to the next question frame. quizTimeline.gotoAndStop("q"+ (currentQuestion + 1)); } } // Function: gradeUser() // Desc: Tallys the user's score at the end of the quiz. function gradeUser() { // Re CPicPage CPicLayer CPicFrameH0*0*0?g 38R00*0*ssss4sx?J CPicShape3sH0*0*0?l= 333sH0*0*0?, Layer 1OCPicPage CPicLayer CPicFrameCPicText {$W|@ TextField2 Arialpa flash quiz  TS$X@Arial(welcome back to the flash quiz. in version 3 of the quiz, we use arrays to store both the user's answers and the correct answers for each question. by using arrays, we make our code more succinct, legible, and easier to extend if we want to add new questions. w @Arialpversion 3 (for flash mx) 8+)@_sans(? CPicShape %Y4X$%%%Y4X%%$22h'&h'&0ـhـ0h  $%Y4X$%%%Y4X%%hـ0hh'&h'&0ـ l 5h'&h'&0ـhـ0h΀%Y4X$%%%Y4X%%$@ 000308@ 3v0003@0&AP3?H housingOO CPicButton d` choice1_btn dj choice2_btnR Rd~ choice3_btn?SW ?-B choice buttons H @Arialq.1  !@ Arialpversion 1  !@ Arialpversion 2  \!@ Arialpversion 3 # @Arial:: ,hArialwhen were movie clips introduced into flash? ?T?6 question 1O ?f  H @Arialq.2 A @Arial:: *hArialwhen was mp3 audio support added to flash?  !@ Arialpversion 3  !@ Arialpversion 4  \!@ Arialpversion 5 ?y ?u question 2OO?WF  q y@Arialpthank you for taking the quiz ?I, quiz endOO ?inita< ?q2/ ?quizEndil labelsO?(//-------------------------------------------------------- // Multiple Choice Quiz, By Colin Moock // Functions and Arrays Version, for Flash MX // For the accompanying tutorial, see Chapters 9 and 11 of // 'ActionScript for Flash MX: The Definitive Guide' //-------------------------------------------------------- // Stop the movie at the first question. stop(); // =================== // INIT QUIZ VARIABLES // =================== // Store a reference to the timeline that contains the quiz user interface. var quizTimeline = this; // Create an array to contain user's answers. var userAnswers = new Array(); // Create an array to contain each question's correct answer. var correctAnswers = [3, 2]; // Create a convenience variable to store the number of // questions in the quiz. var numQuestions = correctAnswers.length; // ===================== // CREATE QUIZ FUNCTIONS // ===================== // Function: answer() // Desc: Registers the user's answers to quiz questions and // advances the quiz through its questions. // Params: choice The user's answer for the current question. function answer (choice) { // Add the current answer to the list of user answers. userAnswers.push(choice); // Create a convenient variable to store the number // of the current question. var currentQuestion = userAnswers.length; // Display the question and answer in the Output window for debugging. trace("Question " + currentQuestion + ". The user answered: " + userAnswers[currentQuestion-1] + "."); // If we're on the last question... if (currentQuestion == numQuestions) { // ...go to the quiz end frame. quizTimeline.gotoAndStop("quizEnd"); // And grade the user. gradeUser(); } else { // ...otherwise, go to the next question frame. quizTimeline.gotoAndStop("q"+ (currentQuestion + 1)); } } // Function: gradeUser() // Desc: Tallys the user's score at the end of the quiz. function gradeUser() { // Report that we're about to grade the quiz in the Output window. trace("Quiz complete. Now grading..."); // Create a local variable to track the // number of questions user answered correctly. var totalCorrect = 0; // Count how many questions the user answered correctly. // For each question... for (var i=0; i < numQuestions; i++) { // If the user's answer matches the correct answer. if(userAnswers[i] == correctAnswers[i]) { // Give the user a point. totalCorrect++; } // Display the correct answer and the user's answer // in the Output window for debugging. trace("Question " + (i + 1) + ". Correct answer: " + correctAnswers[i] + ". User's answer: " + userAnswers[i]); } // Display the final score in the Output window for debugging. trace("User's score: " + totalCorrect + "/" + numQuestions); // Create an onscreen text field do display the user's score. quizTimeline.createTextField("totalOutput_txt", 1, 150, 200, 200, 20); // Show the user's score in an onscreen text field. quizTimeline.totalOutput_txt.text = "Your final score is: " + totalCorrect + "/" + numQuestions; // Customize the font face, size, and color of the text field. var formatObj = new TextFormat(); formatObj.size = 16; formatObj.color = 0xC7FF9C; formatObj.font = "_sans"; formatObj.bold = true; quizTimeline.totalOutput_txt.setTextFormat(formatObj); } // ================================= // DEFINE QUIZ BUTTON EVENT HANDLERS // ================================= // Code executed when button 1 is pressed. choice1_btn.onRelease = function () { // Call answer(), which records the user's choice // and advances the quiz to the next question. this._parent.answer(1); }; // Code executed when button 2 is pressed. choice2_btn.onRelease = function () { this._parent.answer(2); }; // Code executed when button 3 is pressed. choice3_btn.onRelease = function () { this._parent.answer(3); }; port that we're about to grade the quiz in the Output window. trace("Quiz complete. Now grading..."); // Create a local variable to track the // number of questions user answered correctly. var totalCorrect = 0; // Count how many questions the user answered correctly. // For each question... for (var i=0; i < numQuestions; i++) { // If the user's answer matches the correct answer. if(userAnswers[i] == correctAnswers[i]) { // Give the user a point. totalCorrect++;  scriptsO et9nFf=Symbol 1button9Q9*@hhhhhf z PublishRNWKProperties::) CDocumentPagePage 1Scene 1et9 }=Symbol 1button9Q9*@hhhhhf z%PublishFormatProperties::htmlFileName quiz-mx.html"PublishHtmlProperties::StartPaused0!PublishGifProperties::PaletteName PublishRNWKProperties::speed256K0PublishFormatProperties::jpeg0Vector::Debugging Permitted0PublishHtmlProperties::Loop1"PublishQTProperties::MatchMovieDim1 PublishQTProperties::AlphaOption PublishQTProperties::LayerOptionPublishHtmlProperties::Units0$PublishPNGProperties::OptimizeColors1PublishQTProperties::Width550&PublishRNWKProperties::singleRateAudio0&PublishRNWKProperties::speedSingleISDN0%PublishFormatProperties::projectorMac0&PublishFormatProperties::flashFileName quiz-mx.swfVector::Compress Movie1PublishGifProperties::Smooth1#PublishRNWKProperties::flashBitRate1200%PublishRNWKProperties::mediaCopyright(c) 2000PublishFormatProperties::html1$PublishFormatProperties::pngFileName quiz-mx.png(PublishHtmlProperties::VerticalAlignment1PublishHtmlProperties::Quality4"PublishGifProperties::DitherOption"PublishRNWKProperties::exportAudio1 PublishRNWKProperties::speed384K0!PublishRNWKProperties::exportSMIL1Vector::Override Sounds0!PublishHtmlProperties::DeviceFont0"PublishPNGProperties::FilterOption'PublishRNWKProperties::mediaDescriptionVector::Template0PublishFormatProperties::gif0*PublishFormatProperties::generatorFileName quiz-mx.swtVector::Protect0Vector::Quality80*PublishHtmlProperties::HorizontalAlignment1"PublishHtmlProperties::DisplayMenu1PublishGifProperties::Interlace0"PublishGifProperties::DitherSolids0PublishPNGProperties::Smooth1PublishPNGProperties::BitDepth24-bit with AlphaPublishJpegProperties::DPI4718592PublishQTProperties::Flatten1#PublishFormatProperties::qtFileName quiz-mx.movPublishGifProperties::Width550PublishGifProperties::Loop1PublishRNWKProperties::speed28K1!PublishRNWKProperties::mediaTitle$PublishRNWKProperties::mediaKeywordsPublishFormatProperties::flash1#PublishGifProperties::MatchMovieDim1#PublishGifProperties::PaletteOption"PublishPNGProperties::DitherOptionPublishJpegProperties::Quality80$PublishRNWKProperties::realVideoRate100000$PublishRNWKProperties::speedDualISDN0-PublishFormatProperties::projectorWinFileName quiz-mx.exePublishHtmlProperties::Align0#PublishPNGProperties::MatchMovieDim1#PublishPNGProperties::PaletteOption$PublishJpegProperties::MatchMovieDim1%PublishFormatProperties::jpegFileName quiz-mx.jpgVector::Omit Trace Actions0Vector::Debugging PasswordPublishHtmlProperties::Width550PublishHtmlProperties::Height400"PublishPNGProperties::DitherSolids0"PublishJpegProperties::Progressive0#P } // Display the correct answer and the user's answer // in the Output window for debugging. trace("Question " + (i + 1) + ". Correct answer: " + correctAnswers[i] + ". User's answer: " + userAnswers[i]); } // Display the final score in the Output window for debugging. trace("User's score: " + totalCorrect + "/" + numQuestions); // Create an onscreen text field do display the user's score. quizTimeline.createTextField("totalOutput_txt", 1, 150, 200, 200, 20); // Show the user's score in an onscreen text field. quizTimeline.totalOutput_txt.text = "Your final score is: " + totalCorrect + "/" + numQuestions; // Customize the font face, size, and color of the text field. var formatObj = new TextFormat(); formatObj.size = 16; formatObj.color = 0xC7FF9C; formatObj.font = "_sans"; formatObj.bold = true; quizTimeline.totalOutput_txt.setTextFormat(formatObj); } // ================================= // DEFINE QUIZ BUTTON EVENT HANDLERS // ================================= // Code executed when button 1 is pressed. choice1_btn.onRelease = function () { // Call answer(), which records the user's choice // and advances the quiz to the next question. this._parent.answer(1); }; // Code executed when button 2 is pressed. choice2_btn.onRelease = function () { this._parent.answer(2); }; // Code executed when button 3 is pressed. choice3_btn.onRelease = function () { this._parent.answer(3); };  scriptsO et9},=Symbol 1button9Q9*@hhhhhf z%PublishFormatProperties) CDocumentPagePage 1Scene 1et9 }=Symbol 1button9Q9*@hhhhhf z%PublishFormatProperties::htmlFileName quiz-mx.html"PublishHtmlProperties::StartPaused0!PublishGifProperties::PaletteName PublishRNWKProperties::speed256K0PublishFormatProperties::jpeg0Vector::Debugging Permitted0PublishHtmlProperties::Loop1"PublishQTProperties::MatchMovieDim1 PublishQTProperties::AlphaOption PublishQTProperties::LayerOptionPublishHtmlProperties::Units0$PublishPNGProperties::OptimizeColors1PublishQTProperties::Width550&PublishRNWKProperties::singleRateAudio0&PublishRNWKProperties::speedSingleISDN0%PublishFormatProperties::projectorMac0&PublishFormatProperties::flashFileName quiz-mx.swfVector::Compress Movie1PublishGifProperties::Smooth1#PublishRNWKProperties::flashBitRate1200%PublishRNWKProperties::mediaCopyright(c) 2000PublishFormatProperties::html1$PublishFormatProperties::pngFileName quiz-mx.png(PublishHtmlProperties::VerticalAlignment1PublishHtmlProperties::Quality4"PublishGifProperties::DitherOption"PublishRNWKProperties::exportAudio1 PublishRNWKProperties::speed384K0!PublishRNWKProperties::exportSMIL1Vector::Override Sounds0!PublishHtmlProperties::DeviceFont0"PublishPNGProperties::FilterOption'PublishRNWKProperties::mediaDescriptionVector::Template0PublishFormatProperties::gif0*PublishFormatProperties::generatorFileName quiz-mx.swtVector::Protect0Vector::Quality80*PublishHtmlProperties::HorizontalAlignment1"PublishHtmlProperties::DisplayMenu1PublishGifProperties::Interlace0"PublishGifProperties::DitherSolids0PublishPNGProperties::Smooth1PublishPNGProperties::BitDepth24-bit with AlphaPublishJpegProperties::DPI4718592PublishQTProperties::Flatten1#PublishFormatProperties::qtFileName quiz-mx.movPublishGifProperties::Width550PublishGifProperties::Loop1PublishRNWKProperties::speed28K1!PublishRNWKProperties::mediaTitle$PublishRNWKProperties::mediaKeywordsPublishFormatProperties::flash1#PublishGifProperties::MatchMovieDim1#PublishGifProperties::PaletteOption"PublishPNGProperties::DitherOptionPublishJpegProperties::Quality80$PublishRNWKProperties::realVideoRate100000$PublishRNWKProperties::speedDualISDN0-PublishFormatProperties::projectorWinFileName quiz-mx.exePublishHtmlProperties::Align0#PublishPNGProperties::MatchMovieDim1#PublishPNGProperties::PaletteOption$PublishJpegProperties::MatchMovieDim1%PublishFormatProperties::jpegFileName quiz-mx.jpgVector::Omit Trace Actions0Vector::Debugging PasswordPublishHtmlProperties::Width550PublishHtmlProperties::Height400"PublishPNGProperties::DitherSolids0"PublishJpegProperties::Progressive0#PublishQTProperties::PlayEveryFrame0PublishFormatProperties::png0PublishFormatProperties::rnwk0-PublishFormatProperties::projectorMacFileName quiz-mx.hqxVector::TopDown0!PublishHtmlProperties::WindowMode0'PublishHtmlProperties::TemplateFileNamedE:\Documents and Settings\fritz\Application Data\Macromedia\Flash MX\Configuration\Html\Default.htmlPublishGifProperties::Height400PublishPNGProperties::Interlace0PublishJpegProperties::Size0"PublishFormatProperties::generator0Vector::Report0PublishGifProperties::LoopCount'PublishGifProperties::TransparentOptionPublishGifProperties::MaxColors255%PublishPNGProperties::RemoveGradients0PublishQTProperties::Height400PublishRNWKProperties::speed56K1PublishFormatProperties::qt0Vector::Stream Compress7Vector::Event Format0Vector::Version6$PublishGifProperties::OptimizeColors1"PublishRNWKProperties::audioFormat0Vector::Event Compress7PublishHtmlProperties::Scale0%PublishGifProperties::RemoveGradients0PublishPNGProperties::Width550PublishPNGProperties::Height400PublishJpegProperties::Height400 PublishRNWKProperties::speed512K0$PublishFormatProperties::gifFileName quiz-mx.gifVector::Stream Format0PublishGifProperties::Animated0&PublishGifProperties::TransparentAlpha128!PublishPNGProperties::Transparent0!PublishPNGProperties::PaletteNamePublishJpegProperties::Width550*PublishQTProperties::UseQTSoundCompression0PublishQTProperties::Looping0"PublishRNWKProperties::exportFlash1&PublishRNWKProperties::showBitrateDlog1(PublishRNWKProperties::speedCorporateLAN0"PublishRNWKProperties::mediaAuthorPropSheet::ActiveTab1621%PublishFormatProperties::defaultNames1%PublishFormatProperties::projectorWin0%PublishFormatProperties::rnwkFileName quiz-mx.smilPublishPNGProperties::MaxColors255%PublishQTProperties::ControllerOption0"PublishQTProperties::PausedAtStart0 CColorDef3PfP0PHP`Px333(3f<03CH3F`3Hx333xf3d03]H3Z`3Xx3333303f3PPH33Px`33Px33Pf03f0ffx0fkHfd`f`x3f033fPH3ffxPH3fdx`3f]x3fZH3HfHxH̙n`hx3H33x`3fx`3xx`3̙kx3d`3`f``x`px3`33x3fx3x3xx3nx3xfxxxxx3x333f333xf0f30ff(0f5Hf<`f@xH3 HfH(H2`8xf30f33PHff3(PHf3<x`f3Cxf3F3H33x`f3x`3(x`35x3<ff0f3fPHfff`ffP0xffPxffPfH3fx`ff0xf(0xf<xfCfHf3x`ff0xfx0xublishQTProperties::PlayEveryFrame0PublishFormatProperties::png0PublishFormatProperties::rnwk0-PublishFormatProperties::projectorMacFileName quiz-mx.hqxVector::TopDown0!PublishHtmlProperties::WindowMode0'PublishHtmlProperties::TemplateFileNamedE:\Documents and Settings\fritz\Application Data\Macromedia\Flash MX\Configuration\Html\Default.htmlPublishGifProperties::Height400PublishPNGProperties::Interlace0PublishJpegProperties::Size0"PublishFormatProperties::generator0Vector::Report0PublishGifProperties::LoopCount'PublishGifProperties::TransparentOptionPublishGifProperties::MaxColors255%PublishPNGProperties::RemoveGradients0PublishQTProperties::Height400PublishRNWKProperties::speed56K1PublishFormatProperties::qt0Vector::Stream Compress7Vector::Event Format0Vector::Version6$PublishGifProperties::OptimizeColors1"PublishRNWKProperties::audioFormat0Vector::Event Compress7PublishHtmlProperties::Scale0%PublishGifProperties::RemoveGradients0PublishPNGProperties::Width550PublishPNGProperties::Height400PublishJpegProperties::Height400 PublishRNWKProperties::speed512K0$PublishFormatProperties::gifFileName quiz-mx.gifVector::Stream Format0PublishGifProperties::Animated0&PublishGifProperties::TransparentAlpha128!PublishPNGProperties::Transparent0!PublishPNGProperties::PaletteNamePublishJpegProperties::Width550*PublishQTProperties::UseQTSoundCompression0PublishQTProperties::Looping0"PublishRNWKProperties::exportFlash1&PublishRNWKProperties::showBitrateDlog1(PublishRNWKProperties::speedCorporateLAN0"PublishRNWKProperties::mediaAuthorPropSheet::ActiveTab1621%PublishFormatProperties::defaultNames1%PublishFormatProperties::projectorWin0%PublishFormatProperties::rnwkFileName quiz-mx.smilPublishPNGProperties::MaxColors255%PublishQTProperties::ControllerOption0"PublishQTProperties::PausedAtStart0 CColorDef3PfP0PHP`Px333(3f<03CH3F`3Hx333xf3d03]H3Z`3Xx3333303f3PPH33Px`33Px33Pf03f0ffx0fkHfd`f`x3f033fPH3ffxPH3fdx`3f]x3fZH3HfHxH̙n`hx3H33x`3fx`3xx`3̙kx3d`3`f``x`px3`33x3fx3x3xx3nx3xfxxxxx3x333f333xf0f30ff(0f5Hf<`f@xH3 HfH(H2`8xf30f33PHff3(PHf3<x`f3Cxf3F3H33x`f3x`3(x`35x3<ff0f3fPHfff`ffP0xffPxffPfH3fx`ff0xf(0xf<xfCfHf3x`ff0xfx0xf̙dxf]H3x`f0x̙PPPf`f3xffxfxfxxfk`3xfxPxPdfxf3fffffxx3fx`3 `f̙dxf]H3x`f0x̙PPPf`f3xffxfxfxxfk`3xfxPxPdfxf3fffffxx3fx`3 `f`̙`(`0xx3xfxx x(x3`33xf3 x̙3x3(x323x33f3 333(f`3fxffx̙fxf(xf5fx3ffff ff(f`̙`(`0xx3xfxx x(x3`33xf3 x̙3x3(x323x33f3 333(f`3fxffx̙fxf(xf5fx3ffff ff(`3xfx̙P̙(P<x3f̙(`3xfx̙PPx3f(x3f̙xx3f`3xfx̙P̙(P<x3f̙(`3xfx̙PPx3f(x3f̙xx3f3330fff`xPxx(xxxx0]13330fff`xPxx(xxxx0]1*]"PublishQTProperties::QTSndSettingsCQTAudioSettingsh