Search Support

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

Problema com setInterval

  • No replies
  • 1 has this problem
  • 15 views
more options

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