这是我构建的测验引擎(随意使用它)。我想通过添加图像来扩展它,我从来没有真正做过除变量以外的任何事情,也无法知道如何使用它,我认为这样可行:
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";
}
};
答案 0 :(得分:1)
因为_currentFrame
是只读属性,所以没有任何反应。请改用gotoAndStop(index1 + 1)
。
此外,你应该重写
onEnterFrame = function ()
{
**pic._currentframe = (index1 + 1;**
};
onEnterFrame = function ()
{
question_txt.text = question[index1];
};
到
onEnterFrame = function ()
{
pic.gotoAndStop(index1 + 1);
question_txt.text = question[index1];
};
因为第二个onEnterFrame部分覆盖了第一个