【求助】做考试系统,关于flash输入文本框变量读取的问题
flash吧
全部回复
仅看楼主
level 2
灵石1992 楼主
用flash做类似考试系统。
在1到4帧中有四道题目,第五帧输出正确几道题,错误几道题。
在1到4帧中分别有4个输入文本框以输入答案。分别设置变量t1~t4。
帧5中有两个动态文本框用来显示结果。变量t5~t6。
然后在第1到4帧分别有按钮用来判定输入的对错并跳到下一帧。代码如下:
第一帧的按钮:
on (release)
{nextFrame();
count=0;
error=0;//这两个变量用来存储正确和错误的数量最后赋给t5 t6
if(t1!=“1”)
{error=error+1;}
else
{count=counr+1;}
}
第二帧按钮
on (release)
{nextFrame();
if(t2!=“2”)
{error=error+1;}
else {count=count+1;}
} 第三帧的按钮和第二帧差不多,t2换成t3
第四帧的按钮
on (release)
{nextFrame();
if(t1!=“1”)
{error=error+1;}
else {count=counr+1;}
t5=count;//把正确数显示到t5动态文本框里
t6=error
}
过程就是这样。不过每次调试,不管输入的答案是什么,都显示正确0,错误4。也就是不管t1~t4输入什么,按钮代码都只执行if,执行不到else。 求解!!!!!!!!!!
2014年04月29日 00点04分 1
level 2
灵石1992 楼主
2014年04月29日 00点04分 2
level 9
文本框t1是TextField类,"1"是String类,(t1!="1")的结果肯定是true,请用t1.text。
2014年04月29日 08点04分 3
on (release) { nextFrame(); if(t4.text!="4") { error=error+1; } else { count=count+1; } t5=count.toString(); t6=error.toString(); } 这样改过之后还是不行,求详解
2014年04月29日 13点04分
level 7
t4.text!=="4"要这样才行的
2014年04月29日 13点04分 4
on (release){ nextFrame(); if(t4.text!=="4") { error=error+1; } else { count=count+1; } t5=count.toString(); t6=error.toString();} 这样试过了,还是不行。[委屈]求解
2014年04月29日 14点04分
level 7
我的行啊,朋友,我试过了
yes=0
no=0
//在第一帧设变量
on (release) {
if(t1.text==1){
yes=yes+1
my_yes.text=yes
}else{
no=no+1
my_no.text=no
}
nextFrame();
}
on (release) {
if(t2.text==2){
yes=yes+1
my_yes.text=yes
}else{
no=no+1
my_no.text=no
}
nextFrame();
}
on (release) {
if(t3.text==3){
yes=yes+1
my_yes.text=yes
}else{
no=no+1
my_no.text=no
}
}
实在不行就Q我吧492895170
2014年04月29日 14点04分 5
好的,我明天早上试试。一会儿要断电了。[大拇指][大拇指][大拇指]层主好人![蹭]
2014年04月29日 14点04分
my_yes.text是什么意思?
2014年04月30日 01点04分
level 1
0 0楼主求代码、、、表示不懂做
2015年01月07日 04点01分 8
level 1
好人一生平安 [email protected]
2015年01月07日 04点01分 9
1