日期:2013-12-10  浏览次数:20601 次

  这两天做了一个实时的时钟~ 发上来和大家分享一下!

点击这里下载源文件

newDate = new Date();
newDate.month = newDate.getMonth()+1;
DateTextField =
newDate.getFullYear()+"-"+ newDate.month +"-"+ newDate.getDate();
now_hours = newDate.getHours();
if(length(now_hours)<2){
 now_hours = "0" + now_hours;
}
now_minutes = newDate.getMinutes();
if(length(now_minutes)<2){
 now_minutes = "0" + now_minutes;
}
now_seconds = newDate.getSeconds();
if(length(now_seconds)<2){
 now_seconds = "0" + now_seconds;
}
TimeTextField =
now_hours +":"+ now_minutes +":"+ now_seconds;
_root.second._rotation = newDate.getSeconds()*6; 
_root.minute._rotation = newDate.getMinutes()*6 + newDate.getSeconds()*(1/10);;
_root.hour._rotation = newDate.getHours()*30 + newDate.getMinutes()*(1/2);

原文件传上来,想要学的朋友可以下栽去看看