首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >事件驱动的Actionscript

事件驱动的Actionscript
EN

Stack Overflow用户
提问于 2012-12-30 04:23:18
回答 1查看 122关注 0票数 1

我在使用actionscript项目时遇到问题。我必须问用户一个问题5次,用户必须回答,当用户单击一个按钮时,答案必须得到验证。

有没有办法让for循环等待一个click事件?

我的想法是这样的:

代码语言:javascript
复制
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
}
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2012-12-30 07:37:08

是的,但是使用不同的方式(不是使用for循环):

代码语言:javascript
复制
var questionsAnswered = 0; //in class files put this higher up

nextQuestionButton.addEventListener(MouseEvent.CLICK, nextQuestion);
function nextQuestion(e:MouseEvent){
    trace(questionsAnswered);
    questionsAnswered++;
    // Logic here
}
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/14085616

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档