除去计时器不工作 [英] removing timer is not working

查看:116
本文介绍了除去计时器不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何正确删除/停止动作计时器?

How do I correctly remove/stop a timer in actionscript?

我不喜欢它在这片code,但定时器设置完成后火frame1SoundTimerHandler 200秒:

I do it like in this piece of code but timer has been set to fire frame1SoundTimerHandler in 200 seconds later :

            playingScreenFramesObj.myTimer2.stop(); 
            playingScreenFramesObj.myTimer2.removeEventListener(TimerEvent.TIMER, frame1SoundTimerHandler);
            playingScreenFramesObj.myTimer2 = null;

看来,尽管停止/与code中的处理上面移除该计时器将200秒钟内。

It seems that despite stopping/removing the timer with the code above the handler will run in 200 seconds.

在哪里的错误,我做什么呢?

Where is the mistake I make?

克里斯

推荐答案

您应该只需要调用timer.stop()。作为一种可靠的,你总是可以从事件处理程序内检查timer.running。

You should only have to call timer.stop(). As a failsafe you could always check timer.running from inside the event handler.

这篇关于除去计时器不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆