我的输入文字字段有两个可能的答案,即" luah"或者" hal"但是我的代码无效:
stop();
//var jawapan1=Array;
txt_zuhal.addEventListener(KeyboardEvent.KEY_DOWN,handler);
function handler(event:KeyboardEvent)
{
//jawapan1=("luah", "hal");
// if the key is ENTER
if(event.charCode == 13)
{
if(txt_zuhal.text == 'luah'||'hal')
{
trace("1.correct");
}
else
{
trace("1.Sorry, Wrong answer");
}
}
}
答案 0 :(得分:0)
private function handler(event:KeyboardEvent):void
{
//jawapan1=("luah", "hal");
// if the key is ENTER
if(event.charCode == 13)
{
if(txt_zuhal.text == "luah" || txt_zuhal.text == "hal")
{
trace("1.correct");
}
else
{
trace("1.Sorry, Wrong answer");
}
}
}