Help! ... setInterval issue

Hey! I’m hoping someone can help me. There’s something I’m just not understanding about the setIntervals in my script. I’ve used setInterval before without any problems, but this time they’re returning numerical values incrimenting by 2 each time.

The script consists of:

function r - which returns a random value between the min (i) and max (a) values passed.

function f0 - the initial function that gets called. This function clears the two (‘t’ and ‘m’ - dynamically more than two) timers, runs function ‘f1’ and instantiates a setInterval to recall itself (f0).

function f1 - This function randomly decides wheather the object (passed value ‘obj’) should shrink or grow (functions ‘cG’ and ‘cS’), and then sets an interval to which the object does just that.

function cG - grows the object by 1px.

function cS - shrinks the object by 1px.

Here is my code:

//These are limits as to the 'obj’s _xscale
_global.Li = 80;
_global.La = 100;

r = function(i, a) {
return Math.floor(Math.random()*(a - i)) + i;
}

cG = function(o) {
o._xscale = o._xscale + 1;
o._yscale = o._yscale + 1;
o._x = o._x - 1;
o._y = o._y - 1;
}

cS = function(o) {
o._xscale = o._xscale - 1;
o._yscale = o._yscale - 1;
o._x = o._x + 1;
o._y = o._y + 1;
}

f0 = function(obj, t, m) {
clearInterval(t);
clearInterval(m);
f1(obj,m);
t = setInterval(f0, r(800, 200), obj, t, m);
// Uncommenting the line below illustrates my problem. The story’s the same with ‘m’ in ‘f1’
//trace(t);
}

f1 = function(obj, m) {
if(obj._xscale <= _global.La && obj._xscale >= _global.Li) {
clearInterval(m);
r(1, 99) % 2 ? m = setInterval(cG, r(200, 80), obj) : m = setInterval(cS, r(200, 80), obj);
}
if(obj._xscale > _global.La) {
clearInterval(m);
m = setInterval(cS, r(200, 80), obj);
}
if(obj._xscale < _global.Li) {
clearInterval(m);
m = setInterval(cG, r(200, 80), obj);
}
}

f0(o1, “t1”, “m1”);
// More objects can be targeted as shown below. ‘t1’ and ‘m1’ are variable names gived to the timers set.
//f0(o2, "t2, “m2”);
//f0(o3, "t3, “m3”);
//f0(o4, "t4, “m4”);

Thanks in advance. If you need any additional information please ask.

yours, in Christ
vaughan
(: