#include "questionsArray.as" //// 我改变了一下教程的结构,把questionsArray.as的内容也插入进来了,因为跳过这段的话,看起来会有疑问 //// 以下内容系存放questionsArray.as中的 // 输入数据其实是建立对象 // MOOCK用一个数组还存放这些对象,这样对象才更易于管理 // 不要被括号给弄昏了,输入对象参数的中间还有中括号,是因为输入题目的参数“各个选项”是一个数组 // 因为是存放于数组中,每个对象之间记得应有逗号分隔 // Remember to place a comma after each object // in the array except the last questionsArray = [new Question (2, "Which version of Flash first introduced movie clips?", ["version 1", "version 2", "version 3", "version 4", "version 5", "version 6"]), new Question (2, "When was Action formally declared a ing language?", ["version 3", "version 4", "version 5"]), new Question (1, "Are regular expressions supported by Flash 5 Action?", ["yes", "no"]), new Question (0, "Which sound format offers the best compression?", ["mp3","aiff", "wav"]), new Question (1, "True or False: The post-increment operator (++) returns the value of its operand + 1.", ["true", "false"]), new Question (3, "Action is based on...", ["Java", "Java", "C++", "ECMA-262", "Perl"])]; //// 离开questionsArray.as部分,我们继续 // Begin the quiz 出题目!调用makeQuestion函数来完成,我们只需要给这个函数一个参数:题目的编号,函数就会按编号提取数据,结合我们刚才做的模版生成题目。 makeQuestion(currentQuestion); // Function to render each question to the screen // 下面就是makeQuestion函数 function makeQuestion (currentQuestion) { // Clear the Stage of the last question //这句是清理上一题生成的MC,这句从第二题开始生效,questionClip就是题目的MC名,MC从哪来的?看下面就知道了 questionClip.removeMovieClip(); // Create and place the main question clip // 利用模版questionTemplate生成一个叫questionClip的MC,这个MC就是我们的问题 attachMovie("questionTemplate", "questionClip", 0);