|
Creas 4 cajas de texto dinámico con los nombre de instancia de la parte inferior del script (para dias, horas, minutos y segundos) y en un clip vacío este script.
Date.prototype.countdown = function (obj, _onStatus, _onFinish) { var ms = 86400000; var timer = setInterval(function (o) { var _l1 = new Date(); var _l2 = Math.floor((o.getTime() - _l1.getTime()) / ms); var _l3 = Math.abs(_l1.getHours() - 23); var _l5 = Math.abs(_l1.getMinutes() - 59); var _l4 = Math.abs(_l1.getSeconds() - 60); _onStatus.call(obj, _l2, _l3, _l5, _l4); if (_l2 < 0) { _onFinish.call(obj); clearInterval(timer); } // end if }, 1000, this); }; ASSetPropFlag(Date.prototype, "countdown", 1); var birthday = new Date(2006, 8, 12); var myOnStatus = function (days, hours, minutes, seconds) { this.messageText1 = days; this.messageText2 = hours; this.messageText3 = minutes; this.messageText4 = seconds; }; birthday.countdown(this, myOnStatus, myOnFinish);
|
Por sirguy
Envíale un mensaje privado
|