# SetInterval problems

**URL:** <https://forum.kirupa.com/t/setinterval-problems/47687>\
**Category:** flash\
**Created:** [April 6, 2004, 12:49pm UTC](https://forum.kirupa.com/t/setinterval-problems/47687 "2004-04-06T12:49:39Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![kokoi](https://avatars.discourse-cdn.com/v4/letter/k/b2d939/32.png) [@kokoi](https://forum.kirupa.com/u/kokoi)\
**Post date:** [April 6, 2004, 12:49pm UTC](https://forum.kirupa.com/t/setinterval-problems/47687/1 "2004-04-06T12:49:39Z")

</div>

I’m trying to create an interval so that every 5 seconds the picture is replaced by a random other. I’ve tried working with the setInterval action. But when i used it the picture was only refreshed once and not every 5 seconds. Like it was planned. This is my AS so far.

```auto
countDown = function (varia) {
	x = random(2);
	if (x=1) {
		if (_root.section != "picture1.jpg") {
			_root.section = "picture1.jpg";
			_root.transition.gotoAndPlay("closing");
		}
	}
	if (x=0) {
		if (_root.section != "picture2.jpg") {
			_root.section = "picture2.jpg";
			_root.transition.gotoAndPlay("closing");
		}
	}
};
ID = setInterval(countDown, 5000);

```

I hope that someone can help me.  
thnx in advance
