stop();
var score:int = 0;
if(answer1.text == "Africa")
{
score = score +1
}
第二帧代码
Scoretext2.text = score.toString();
这就是我所有的测试代码
如果我尝试这个代码。生病的一切都是正确的,我的分数会增加
If (answer1.text = "africa" || “Africa” || “AFRICA” )
{
score = score + 1
}
答案 0 :(得分:1)
有几件事......
if (answer1.text = "africa" || “Africa” || “AFRICA” )
{
score = score + 1
}
检查与==运算符的相等性,而不是单个=,如下所示:
if(answer1.text == "africa")
对要检查的每个条件使用OR运算符,如下所示:
if(answer1.text == "africa" || answer1.text == "Africa" || answer1.text == "AFRICA")
但是,所有这些OR运算符都不是必需的。这样做:
var answer:String = answer1.text.toLowerCase();
if(answer == "africa") score++;