I have a continuous loop presentation that is created with a
slide array. In each array there is a color attribute (colorID) to
control the color of the background of the presentation. My
changeColor function works fine until it needs to reset itself to
loop. It gets stuck and no longer increments the counter. For some
reason the if statement still believes that the variable 'p' still
eq 'max', even after I set it to 0.
I've had some issues with variables but I believe the issue
is that you are declaring a local var p inside of the function
itself, so in the if condition remove the var p = 0; and change it
to p = 0;. By defining it as you have it your creating a new
variable and setting the value to p and the interpreter is more
than likely not knowing which p value to use the one outside of the
function or the one inside of the function.