因此,我已经在一个更大的项目上工作了一段时间,我对正在集成到其中的一个测验感到有点困惑。
我想使用组合框创建一个真/假测验。我将使用交换机结构来跟踪最终用户的答案。我现在已经知道如何使用组合框的开关结构,但是,我不确定如何:
1)确定组合框中的所有标签是否正确,以及;
2)我如何使我的结构evn工作。我现在有麻烦了。
请参阅下面的代码。您将看到这是一个逻辑错误。我不确定是什么问题,因此再次感谢您的帮助!
谢谢
-零;
import fl.controls.ComboBox;
import flash.events.MouseEvent;
F21next_btn.visible=false;
firstTF_cb.addItem({label: "True"});
firstTF_cb.addItem({label: "False"});
secondTF_cb.addItem({label: "True"});
secondTF_cb.addItem({label: "False"});
thirdTF_cb.addItem({label: "True"});
thirdTF_cb.addItem({label: "False"});
fourthTF_cb.addItem({label: "True"});
fourthTF_cb.addItem({label: "False"});
fifthTF_cb.addItem({label: "True"});
fifthTF_cb.addItem({label: "False"});
F21check_btn.addEventListener(MouseEvent.CLICK, F21checkAnswers);
F21next_btn.addEventListener(MouseEvent.CLICK, F21goToFrameTwentytwo);
var firstCB:ComboBox;
var secondCB:ComboBox;
var thirdCB:ComboBox;
var fourthCB:ComboBox;
var fifthCB:ComboBox;
firstCB=firstTF_cb;
secondCB=secondTF_cb;
thirdCB=thirdTF_cb;
fourthCB=fourthTF_cb;
fifthCB=fifthTF_cb;
function F21goToFrameTwentytwo(event:MouseEvent):void{
gotoAndStop(22);
}
//HOW DO U CHECK IF A COMBO BOX ITEM IS TRUE/FALSE AND SELECTED
function F21checkAnswers(event:MouseEvent):void
{
switch(firstCB)
{
case "True":
{
firstQ_txt.textColor=0x00FF00;
break;
}
case "False":
{
firstQ_txt.textColor=0xFF0000;
break;
}
}
switch(secondCB)
{
case "True":
{
secondQ_txt.textColor=0x00FF00;
break;
}
case "False":
{
secondQ_txt.textColor=0xFF0000;
break;
}
}
switch(thirdCB)
{
case "True":
{
thirdQ_txt.textColor=0x00FF00;
break;
}
case "False":
{
thirdQ_txt.textColor=0x00FF00;
break;
}
}
switch(fourthCB)
{
case "True":
{
fourthQ_txt.textColor=0x00FF00;
break;
}
case "False":
{
fourthQ_txt.textColor=0xFF0000;
break;
}
}
switch(fifthCB)
{
case "True":
{
fifthQ_txt.textColor=0x00FF00;
break;
}
case "False":
{
fifthQ_txt.textColor=0xFF0000;
break;
}
}
}