Ver Mensaje Individual
  #4 (permalink)  
Antiguo 18/04/2008, 09:59
Avatar de Mahalo
Mahalo
 
Fecha de Ingreso: julio-2004
Ubicación: Mallorca (Illes Balears)
Mensajes: 1.121
Antigüedad: 19 años, 8 meses
Puntos: 12
Re: Pausa en Actionscript

Código:
var id:Number;
var index:Number = 0;
agenda_noticias = new XML();
agenda_noticias.ignoreWhite = 1;
_root.createEmptyMovieClip("foto",10);
foto._x = 5;
foto._y = 45;
foto.loadMovie("foto.jpg");

function muestraNoticia() {
   titular_txt.text=this.firstChild.childNodes[index].childNodes[0].attributes.titular;
   cuerpo_txt.text=this.firstChild.childNodes[index].childNodes[0].attributes.cuerpo;
   index++;
   if (index>=agendanoticias.firstChild.childNodes.length) {
      index = 0;
   }
}

parsea=function(exito){
	if (exito){
		for(i=0; i<this.firstChild.childNodes.length; i++)
		{
			id = setInterval(this, "muestraNoticia", 10000);	
				
			}
	}
	else
	{
		trace("Error");
		}
}
agenda_noticias.load("noticias.xml");
agenda_noticias.onLoad = parsea;
Hecho así a lo rápido, que ya empieza el fin de semana....

La variable index es la que se mueve por el XML. La variable id es la que va asignada con el setInterval. Luego la función muestraNoticia hace lo mismo que tenías tú. La línea del setInterval está configurado a 10 segundos (10000 milisegundos).
Y nada más, buen fin de semana!
__________________
Los ignorantes se empeñan en enseñar. Los sabios en aprender.
SourceForge