This is my function, when called the related node turns red and then does nothing.
Here is the javascript:
function blink (node, flickers)
{
originalColo
i
is "i
when the anonymous function is called" not "i
when setTimeout
is called".
You need to create a closure and pass the current value of i
into it.
function ChangeColorLater(i) {
return function () {
ChangeColor (node, (((i%2) == 0) ? (originalColour) : ('red')))
}
}
setTimeout (ChangeColourLater(i), (i*200));