# SetInterval Question

**URL:** <https://forum.kirupa.com/t/setinterval-question/49869>\
**Category:** flash\
**Created:** [April 27, 2004, 1:57pm UTC](https://forum.kirupa.com/t/setinterval-question/49869 "2004-04-27T13:57:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ghjr](https://avatars.discourse-cdn.com/v4/letter/g/dec6dc/32.png) [@ghjr](https://forum.kirupa.com/u/ghjr)\
**Post date:** [April 27, 2004, 1:57pm UTC](https://forum.kirupa.com/t/setinterval-question/49869/1 "2004-04-27T13:57:45Z")

</div>

I’m using the setInterval function to build up a menu. This is the call for the Interval:

```auto

chamada = 1;
intervaloID = setInterval( intervalo(), 1000 );

```

And this is the function that is supposed to be called at every second:

```auto

function intervalo() {
		
if (chamada == "1" ) {
			bt_movimento_spy.easeX(bt_spy._x, bt_movimento_spy, bt_spy);
        	trace("interval called");
			trace (chamada);
			chamada ++;
			trace (chamada);
		}
		
else if (chamada == "2" ) {
			bt_movimento_eventos.easeX(bt_eventos._x, bt_movimento_eventos, bt_eventos);
			trace("interval called");
			clearInterval( intervaloID );
		}

}

```

The function called the first item, and then set the “chamada” variable to 2, which I thought would call the second item next time around, but that didn´t happen. It just called the first item and then stopped.

Any ideas?? Thanks!! C:-)

ghjr
