Image AS2测验图像
这是我创建的一个测验引擎(可以随意使用)。我想通过添加图像来扩展它,除了变量之外,我从来没有做过其他任何事情,也不知道如何使用它,我认为这会起作用:Image AS2测验图像,image,actionscript,actionscript-2,movieclip,Image,Actionscript,Actionscript 2,Movieclip,这是我创建的一个测验引擎(可以随意使用)。我想通过添加图像来扩展它,除了变量之外,我从来没有做过其他任何事情,也不知道如何使用它,我认为这会起作用: onEnterFrame = function () { **pic._currentframe = (index1 + 1);** }; 有一个叫做“pic”的电影唇;它充满了提示答案的位图。当索引改变时,“pic”不会改变,它只是。。。什么也不做 answer = new Array(); answer[0] = ["oke
onEnterFrame = function ()
{
**pic._currentframe = (index1 + 1);**
};
有一个叫做“pic”的电影唇;它充满了提示答案的位图。当索引改变时,“pic”不会改变,它只是。。。什么也不做
answer = new Array();
answer[0] = ["okey dokey"];
answer[1] = ["sample", "sample1"]
question = new Array();
question[0] = "Type 'Okey Dokey'";
question[1] = "Sample?";
index1 = 0;
onEnterFrame = function ()
{
**pic._currentframe = (index1 + 1;**
};
onEnterFrame = function ()
{
question_txt.text = question[index1];
};
enter1.onRelease = function()
{
question_txt.text = question[index1];
var correct = false;
for (var i = 0; i < answer[index1].length; i++)
{
if (answer_input.text.indexOf(prevEntry) == -1)
{
if (answer_input.text.toLowerCase().indexOf(answer[index1][i]) >= 0)
{
correct = true;
}
}
if (answer_input.text == "admin")
{
correct = true;
}
}
if (correct)
{
index1++;
prevEntry = answer_input.text;
answer_input.text = "";
}
else
{
answer_input.text = "incorrect";
}
};
answer=newarray();
回答[0]=[“好的”;
答案[1]=[“样本”,“样本1”]
问题=新数组();
问题[0]=“键入‘Okey Dokey’”;
问题[1]=“样本?”;
index1=0;
onEnterFrame=函数()
{
**图._currentframe=(index1+1**
};
onEnterFrame=函数()
{
question_txt.text=问题[index1];
};
enter1.onRelease=函数()
{
question_txt.text=问题[index1];
var correct=false;
对于(var i=0;i=0)
{
正确=正确;
}
}
如果(回答输入文本=“管理”)
{
正确=正确;
}
}
如果(正确)
{
index1++;
prevEntry=答案\输入.text;
答案_input.text=“”;
}
其他的
{
回答_input.text=“不正确”;
}
};
由于\u currentFrame
是只读属性,因此不会发生任何事情。请改用
此外,您应该重写
onEnterFrame = function ()
{
**pic._currentframe = (index1 + 1;**
};
onEnterFrame = function ()
{
question_txt.text = question[index1];
};
到
因为第二个onEnterFrame部分覆盖了第一个,改变了舞台的框架?你必须在你想要控制的MovieClip上调用它。所以使用pic.gotoAndStop(index1+1);在你的例子中,使用pic.onEnterFrame=function(){pic.gotoAndStop(index1+1);};太棒了,谢谢。AS3告诉你一个函数是否被使用了两次,不是吗?AS3会阻止你两次定义一个函数,但不会阻止你分配一个变量(持有一个函数)两次——这就是你在这里所做的。顺便说一句,在AS3中使用OneInterFrame的整个系统是不同的——它使用事件和侦听器来处理这些事件。
onEnterFrame = function ()
{
pic.gotoAndStop(index1 + 1);
question_txt.text = question[index1];
};