PDA

View Full Version : clearTimeout problem


ASAAKI
10-06-2002, 10:04 PM
i have a function fire(whichbomb) that animates an element.
i also have setTimeout("fire('"+currBomb.id+"')",250)
to stop the animation, i tried
clearTimeout("fire("+someBomb.id+")")
didn't work, the bomb went on sailing :(
:confused:

Carl
10-06-2002, 10:37 PM
Its just clearTimeout();

x_goose_x
10-06-2002, 10:38 PM
tmp = setTimeout("something()",10000);

clearTimeout(tmp);

Mr J
10-07-2002, 03:08 PM
Yep .
you need to give your setTimeout a name then use that in the clearTimeout

timer=setTimeout("fire('"+currBomb.id+"')",250)


clearTimeout(timer)

ASAAKI
10-08-2002, 08:09 AM
thanx:)
i had lots of animated elements, so what i did was use a loop and have a timer array to store each timer, and then did:
clearTimeout(timer[whatever.id])
it worked. thanx, really needed it