我在使用actionscript项目时遇到问题。我必须问用户一个问题5次,用户必须回答,当用户单击一个按钮时,答案必须得到验证。
有没有办法让for循环等待一个click事件?
我的想法是这样的:
for(teller = 0; teller < 5; teller++){
//show new question
//user answers , and when finished the user clicks the button
buttonNext.addEventListener(MouseEvent.CLICK,checkAnswer);
//it has to wait until the user clicks the button , and then begin all over again
}发布于 2012-12-30 07:37:08
是的,但是使用不同的方式(不是使用for循环):
var questionsAnswered = 0; //in class files put this higher up
nextQuestionButton.addEventListener(MouseEvent.CLICK, nextQuestion);
function nextQuestion(e:MouseEvent){
trace(questionsAnswered);
questionsAnswered++;
// Logic here
}https://stackoverflow.com/questions/14085616
复制相似问题