Tengo un clic de pelicula que es una cuenta regresiva que la uso en una pagina web (Codigo tomado de un ej encontrado por la Web). Obviamente que para ser una cuenta regresiva tiene una fecha de referencia a la cual debe llegar.
El "problema" es justamente que me es un poco molesto tener que volver a configurar esa fecha cada vez que llega a 0: Entrar al .fla, modificarlo, resubirlo a la pagina, limpiar el cache para que no me tome el .swf viejo y demas...
Entonces me preguntaba: ¿Es muy dificil modificar el siguiente codigo para en vez de entrar a configurar todo esto que mensiono tome los datos directamente desde un .txt externo? (Como se hace, por ej, con los campos de texto). Yo lo he intentado pero no se me ha ocurrido la forma correcta para que me funcione.
Desde ya agradezco el tiempo y su ayuda.
Saludos!.
Código ActionScript :
onClipEvent (load) { countdown = "yes"; // Target Time Information tyear = 2009; tmonth = 12; tday = 31; thours = 18; tminutes = 00; tseconds = 00; // } onClipEvent (enterFrame) { if (countdown == "yes") { mon = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"]; daysinmonth = ["31", "28", "31", "30", "31", "30", "31", "31", "30", "31", "30", "31"]; now = new Date(); nyear = now.getFullYear(); nmonth = mon[now.getMonth()]; ndays = daysinmonth[now.getMonth()]; nday = now.getDate(); nhours = now.getHours(); nminutes = now.getMinutes(); nseconds = now.getSeconds(); // Year Code ryear = tyear-nyear; //Month Code if (tmonth>=nmonth) { rmonth = tmonth-nmonth; } else { rmonth = (12-nmonth)+tmonth; ryear = ryear-1; } // Day Code if (tday>=nday) { rday = tday-nday; } else { rday = (ndays-nday)+tday; rmonth = rmonth-1; if (rmonth<0) { ryear = ryear-1; rmonth = 12+rmonth; } } // Hour Code if (thours>=nhours) { rhours = thours-nhours; } else { rhours = (24-nhours)+thours; rday = rday-1; if (rday<0) { rmonth = rmonth-1; rday = Number(ndays)+Number(rday); if (rmonth<0) { ryear = ryear-1; rmonth = 12+rmonth; } } } // Minute Code if (tminutes>=nminutes) { rminutes = tminutes-nminutes; } else { rminutes = (60-nminutes)+tminutes; rhours = rhours-1; if (rhours<0) { rday = rday-1; rhours = 24+rhours; if (rday<0) { rmonth = rmonth-1; rday = Number(ndays)+Number(rday); if (rmonth<0) { ryear = ryear-1; rmonth = 12+rmonth; } } } } // Seconds Code if (tseconds>=nseconds) { rseconds = tseconds-nseconds; } else { rseconds = (60-nseconds)+tseconds; rminutes = rminutes-1; if (rminutes<0) { rhours = rhours-1; rminutes = 60+rminutes; if (rhours<0) { rday = rday-1; rhours = 24+rhours; if (rday<0) { rmonth = rmonth-1; rday = Number(ndays)+Number(rday); if (rmonth<0) { ryear = ryear-1; rmonth = 12+rmonth; } } } } } // Countdown Checker if (ryear<0) { disyear = 0; dismonth = 0; disday = 0; dishours = 0; disminutes = 0; disseconds = 0; discountdown = "no"; this.play(); countdown = "no"; } else { // Update Clock Check if (ryear ne year) { year = ryear; if (year<10) { this.years.years.disyear = "0"+year; } else { this.years.years.disyear = year; } this.years.play(); } if (rmonth ne month) { month = rmonth; if (month<10) { this.months.months.dismonth = "0"+month; } else { this.months.months.dismonth = month; } this.months.play(); } if (rday ne day) { day = rday; if (day<10) { this.days.days.disday = "0"+day; } else { this.days.days.disday = day; } this.days.play(); } if (rhours ne hours) { hours = rhours; if (hours<10) { this.hour.hour.dishours = "0"+hours; } else { this.hour.hour.dishours = hours; } this.hour.play(); } if (rminutes ne minutes) { minutes = rminutes; if (minutes<10) { this.minute.minute.disminutes = "0"+minutes; } else { this.minute.minute.disminutes = minutes; } this.minute.play(); } if (rseconds ne seconds) { seconds = rseconds; if (seconds<10) { this.second.second.disseconds = "0"+seconds; } else { this.second.second.disseconds = seconds; } this.second.play(); } } } }