|
|
发表于 2006-6-11 06:45:20
|
显示全部楼层
// [Action in Frame 1]
change = true;
currentDate = new Date();
eventDate = new Date(2006, 5, 9);
eventDate.setHours(18);
eventDate.setMinutes(0);
eventDate.setSeconds(0);
eventMillisecs = eventDate.getTime();
this.onEnterFrame = function ()
{
if (change == true)
{
old_s0 = s0;
old_s1 = s1;
old_m0 = m0;
old_m1 = m1;
old_h0 = h0;
old_h1 = h1;
old_d0 = d0;
old_d1 = d1;
old_d2 = d2;
} // end if
currentDate = new Date();
currentMillisecs = currentDate.getTime();
msecs = eventMillisecs - currentMillisecs;
if (msecs >= 0)
{
_s0 = "0";
_s1 = "1";
_m0 = "0";
_m1 = "0";
_m2 = "0";
_h0 = "0";
_h1 = "0";
_d0 = "0";
_d1 = "0";
_d2 = "0";
} // end if
s = Math.floor(msecs / 1000);
m = Math.floor(s / 60);
h = Math.floor(m / 60);
d = Math.floor(h / 24);
trace("dagar" + d);
msecs = String(this.msecs % 1000);
s = String(s % 60);
m = String(m % 60);
h = String(h % 24);
d = String(d);
while (msecs.length < 3)
{
msecs = "0" + msecs;
} // end while
if (s.length < 2)
{
s = "0" + s;
} // end if
if (m.length < 2)
{
m = "0" + m;
} // end if
if (h.length < 2)
{
h = "0" + h;
} // end if
while (d.length < 3)
{
d = "0" + d;
} // end while
_days = new String(d);
d0 = _days.substr(0, 1);
d1 = _days.substr(1, 1);
d2 = _days.substr(2, 1);
_hours = new String(h);
h0 = _hours.substr(0, 1);
h1 = _hours.substr(1, 1);
_minutes = new String(m);
m0 = _minutes.substr(0, 1);
m1 = _minutes.substr(1, 1);
_seconds = new String(s);
s0 = _seconds.substr(0, 1);
s1 = _seconds.substr(1, 1);
if (change == true)
{
if (old_s0 != s0)
{
_s0._prev = old_s0;
_s0._next = s0;
_s0.gotoAndPlay(2);
change = false;
} // end if
if (old_s1 != s1)
{
_s1._prev = old_s1;
_s1._next = s1;
_s1.gotoAndPlay(2);
change = false;
} // end if
if (old_m1 != m1)
{
_m1._prev = old_m1;
_m1._next = m1;
_m1.gotoAndPlay(2);
change = false;
} // end if
if (old_m0 != m0)
{
_m0._prev = old_m0;
_m0._next = m0;
_m0.gotoAndPlay(2);
change = false;
} // end if
if (old_h1 != h1)
{
_h1._prev = old_h1;
_h1._next = h1;
_h1.gotoAndPlay(2);
change = false;
} // end if
if (old_h0 != h0)
{
_h0._prev = old_h0;
_h0._next = h0;
_h0.gotoAndPlay(2);
change = false;
} // end if
if (old_d2 != d2)
{
_d2._prev = old_d2;
_d2._next = d2;
_d2.gotoAndPlay(2);
change = false;
} // end if
if (old_d1 != d1)
{
_d1._prev = old_d1;
_d1._next = d1;
_d1.gotoAndPlay(2);
change = false;
} // end if
if (old_d0 != d0)
{
_d0._prev = old_d0;
_d0._next = d0;
_d0.gotoAndPlay(2);
change = false;
} // End of the function
} // end if
} // end if |
|