1
我有这样的代码,使图像动画,但我希望在动画是通过调用clearTimeout(gLoop);
调用setTimeout函数之后的函数
var Animate = function(){
Clear();
MoveDown();
gLoop = setTimeout(Animate,40);
}
var MoveDown = function(){
// animation code
if(velocity==0){
clearTimeout(gLoop);
AnotherAction(); //Here is not working
}
}
在哪里我应该做的通话结束后要调用的函数AnotherAction()
到AnotherAction()
?
我不明白,为什么会'clearTimeout()'另一个函数调用之前不允许调用该函数? – 2011-12-19 05:48:26
@JaredFarrish - 它会允许调用其他函数,但我认为问题在于调用Animate的原始setTimeout仍然被解雇,这是他的结果搞砸了。 – 2011-12-19 05:49:27
Ohhhhhh,我明白了。 – 2011-12-19 05:51:13