Iw been searching high and low the last days after a tutorial that actually work and thats not to advanced. I stumbled over this code the other day:
// 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);
var birthday = new Date(2006, 4, 26);
var myOnStatus = function(days, hours, minutes, seconds) {
_root.messageText = days +" days, ";
_root.messageText += hours + " hours, " + minutes + " minutes";
_root.messageText += " and " + seconds + " secunds left";
};
var myOnFinish = function() {
_root.messageText = "Countdown done";
};
// the 1st parameter indicates
// the object to which the callbacks will be applied
birthday.countdown(this, myOnStatus, myOnFinish);
The problem is this >
var birthday = new Date(2006, 4, 26); //Should be april 26 2006
Looks fine right? But when i make the swf file it looks like this:
As u can see, 99 days to April 26? Dont think so. Should be more like 50-60 days max.
So my question is: how do i get this script to work? How can i fix it?
Plz be aware that im not that good of a coder :block: Be gentle
[COLOR=red]Question 2:[/COLOR]
[COLOR=black]I aslo need 2 insert a line that counts down to a certain time aslo >[/COLOR]
18.30 > total output should show > April 26 2006 18.30 CET
Same problem here, have no clue how i should script it and i cant find a tutorial.
Well, i realy hope that someone can help me with the first problem, since its more importent then the second. And i know ppl dont like beeing asked to scrip for other ppl, but im hoping its a small thing for someone that knows there **** :hoser:
Many thx