P
ROTOTYPE
I'm Not Only The Prototype, I'm Also A Member.
home
▪
stats
▪
search
▪
linkback
▪
about
▪
FAQ
| user: guest,
login
,
register
Date
:
Date.countdown Method
author:
Jonas Galvez
[+]
,
Submitted: 01.27.03 2a
// Date.countdown Method v1.0 // by Jonas Galvez (jonas@onrelease.org) Date.prototype.countdown = function(obj, _onStatus, _onFinish) { var ms = 24 * 60 * 60 * 1000; var timer = setInterval(function(o) { var _current = new Date(); var _days = Math.floor((o.getTime()-_current.getTime())/ms); var _hours = Math.abs(_current.getHours()-23); var _minutes = Math.abs(_current.getMinutes()-59); var _seconds = Math.abs(_current.getSeconds()-60); _onStatus.call(obj, _days, _hours, _minutes, _seconds); if(_days < 0) { _onFinish.call(obj); clearInterval(timer); }; }, 1000, this); }; ASSetPropFlag(Date.prototype, "countdown", 1);
usage
var birthday = new Date(2003, 2, 5); // 03-05-2003 var myOnStatus = function(days, hours, minutes, seconds) { _root.messageText = "There are " + days + " days, "; _root.messageText += hours + " hours, " + minutes + " minutes"; _root.messageText += " and " + seconds + " seconds left to my birthday."; }; var myOnFinish = function() { _root.messageText = "Let's party! =)"; }; // the 1st parameter indicates // the object to which the callbacks will be applied birthday.countdown(this, myOnStatus, myOnFinish);
msg
1
{
Flash4U
[+]
, posted: 07.07.03 11p•-, top
[^]
}
Hi.
Here's my version of it.
I made it before I saw this.
Not as clean, but it's got alot of potential. :)
http://www.yitzyk.com/examples/count_down.swf
-Flash4U
Add Comment
[+]
›opyleft 2001-2010. Layer51 is: Jaime Prado.
@