X
Tap here to go to the mobile version of the site.

Support Forum

Problema com setInterval

  • No replies
  • 1 has this problem
  • 15 views
Posted

Estou com problema para retornar o status para o action script, porque a função setInterval nao esta funcionando no firefox.

//VARIAVEIS DE CONTROLE DE STATUS DA CONEXAO
	var _status = navigator.onLine;
	
	function conexaoOn_fc()
	{
		return(_status);	
	}
	
	var checarConexaoOn = window.setInterval(function() { 'aviso1_fc()' }, 2000);		//enquanto estiver on
	var checarConexaoOf = window.setInterval(function() { 'aviso2_fc()' }, 2000);		//enquanto estiver off
	clearInterval(checarConexaoOf)										//desativa a busca online
	
	//CASO ONLINE
	function aviso1_fc()
	{
		_status = navigator.onLine;
		
		if(_status == false)			
		{	
			clearInterval(checarConexaoOn);
			//alert("PASSOU PARA OFFLINE");
			checarConexaoOf = window.setInterval(function() { 'aviso2_fc()' }, 2000);		//fica offline
		}
	}
	

	//CASO OFFLINE
	function aviso2_fc()
	{
		_status = navigator.onLine;
		
		if(_status == true)			
		{		
			clearInterval(checarConexaoOf);
			//alert("PASSOU PARA ONLINE");
			checarConexaoOn = window.setInterval(function() { 'aviso1_fc()' }, 2000);		//fica online
		}
	}
Estou com problema para retornar o status para o action script, porque a função setInterval nao esta funcionando no firefox. <pre><nowiki>//VARIAVEIS DE CONTROLE DE STATUS DA CONEXAO var _status = navigator.onLine; function conexaoOn_fc() { return(_status); } var checarConexaoOn = window.setInterval(function() { 'aviso1_fc()' }, 2000); //enquanto estiver on var checarConexaoOf = window.setInterval(function() { 'aviso2_fc()' }, 2000); //enquanto estiver off clearInterval(checarConexaoOf) //desativa a busca online //CASO ONLINE function aviso1_fc() { _status = navigator.onLine; if(_status == false) { clearInterval(checarConexaoOn); //alert("PASSOU PARA OFFLINE"); checarConexaoOf = window.setInterval(function() { 'aviso2_fc()' }, 2000); //fica offline } } //CASO OFFLINE function aviso2_fc() { _status = navigator.onLine; if(_status == true) { clearInterval(checarConexaoOf); //alert("PASSOU PARA ONLINE"); checarConexaoOn = window.setInterval(function() { 'aviso1_fc()' }, 2000); //fica online } }</nowiki></pre>

Modified by cor-el

Additional System Details

Application

  • User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.52 Safari/537.17

More Information