首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >定时器警报-修复

定时器警报-修复
EN

Stack Overflow用户
提问于 2010-09-01 04:11:10
回答 2查看 232关注 0票数 2

我有一个定时器警报:

代码语言:javascript
运行
复制
private var cheat:Timer;

private function init():void {
    cheat = new Timer(2000, 1);
    cheat.addEventListener(TimerEvent.TIMER_COMPLETE, cheatProtection);
}

private function showAlert():void {
    cheat.reset();
    cheat.start();
}
private function alrt_close(evt:CloseEvent):void {
    cheat.stop();
}

private function cheatProtection(evt:TimerEvent):void {
    Alert.show("Text", "Label", Alert.OK, this, alrt_close);
}

所以我所做的就是调用showAlert(),但是Alert (cheatProtection函数)并没有发生。怎么啦?

谢谢你,燕

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2010-09-01 04:40:34

应该是:

代码语言:javascript
运行
复制
private var cheat:Timer;

private function init():void {
    cheat = new Timer(2000, 1);
    cheat.addEventListener(TimerEvent.TIMER_COMPLETE, cheatProtection);
    cheat.start();
}

private function showAlert():void {
    cheat.reset();
    cheat.start();
}
private function alrt_close(evt:CloseEvent):void {
    cheat.stop();
}

private function cheatProtection(evt:TimerEvent):void {
    Alert.show("Text", "Label", Alert.OK, this, alrt_close);
}
init();
票数 1
EN

Stack Overflow用户

发布于 2010-09-01 04:21:30

不知道这是否有帮助,但在Adobe Flex文档中,TimerEvent侦听器是在调用start()之后添加的。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/3612821

复制
相关文章

相似问题

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