Hi, I have an interval that executes a function every certain amount of time. This time is supposed to be controled by a variable called “frecuencia”. The thing is, when I change the variable the interval will still use the same original value. How can I make the interval UPDATE after I change the variable?. Here is the code:
var Items = new Array(bombon, regalo, corazon);
pos = new Object();
pos._x=random(550);
i=0
itemspeed=5
frecuencia=1000
goal=10
function lvlup(){
frecuencia-=200
goal+=20
level++;
}
function randomize (){
targeta=Items[random(3)]
pos._x=random(550);
targeta.duplicateMovieClip("item"+i,i,pos);
i++;
}
var Int = setInterval(randomize, frecuencia);
I am calling the function lvl up in a separate part.