SetInterval problems

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.

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

  1. if (x==1), not x=1.
  2. What’s the use of varia?

I’ve replaced the = by == and I dropped the varia. That was something i saw in a tute but i’d never got the use of it. So replaced “countDown = function (varia) {” by function(countDown){ but it still doesn’t work.

You mean function countDown () {}, right?

oops, ok you see I’m quite new to flash. I changed it and now it works. Thnx Pom you were very helpful

no problem :cowboy: