setTimeout

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • macaco
    New Member
    • Apr 2007
    • 9

    setTimeout

    Hi, I need a function that is called every certain amount of time (which is variable).

    I coded this, but seems to be making some sort of infinite loop, as it hangs the browser (or the OS on old computers)

    Code:
    function slideFotos(seccion){
    	//clearTimeout(intervarID);
    	if (info[seccion+'0'] != undefined){
    		siguiente = _root.photoActual + 1;
    		if (info[seccion+siguiente] != undefined){
    			photoInfo.url = "img/subidas/"+info[seccion+siguiente];
    			_root.TTS = "img/subidas/"+info[seccion+"T"+siguiente];
    			_root.photoActual++;
    		} else {
    			photoInfo.url = "img/subidas/"+info[seccion+'0'];
    			_root.TTS = "img/subidas/"+info[seccion+"T0"];
    			_root.photoActual = 0;
    		}
    	}
    	intervalID = setTimeout(this, 'slideFotos', (parseInt(_root.TTS)*1000), seccion);
    }
    How can this be fixed?

    Many thanks in avance.
Working...