flash制作模拟时钟的小问题
以下是实时时钟代码,祝您成功!
function startClock()
{
var _loc2 = new Date();
seconds = _loc2.getSeconds();
minutes = _loc2.getMinutes();
hours = _loc2.getHours() % 12;
hoursDelta = Math.floor(minutes / 60 * 30);
minutesDelta = Math.round(seconds / 60 * 6);
_root.clock.secondsObj._rotation = seconds * 6;
_root.clock.hoursObj._rotation = hours * 30 + hoursDelta;
_root.clock.minutesObj._rotation = minutes * 6 + minutesDelta;
} // End of the function
var nTimer = new Number();
startClock();
nTimer = setInterval(startClock, 1000);