#12001/5/28 20:53:13
这是我照书做的,叫电子钟,也就是《深入FLASH5编程》中的,可是我做完后运行时发现有错误,
所显示的时间与系统时间有不同,所显示的小时要快一个小时,月份要慢一个月,英文的正常。
我照写的代码如下:
onClipEvent (load) {
days = new Array('Sunday','Monday','Tuesday','Wednesday','thursday','Friday','Saturday');
months = new Array('January','February','March','April','May','June','July','August','September',
'October','November','December');
timedate=new Date();
}
onClipEvent (enterFrame) {
hour = timedate.getHours();
minutes = timedate.getMinutes();
seconds = timedate.getSeconds();
todaydate = timedate.getDate();
day = timedate.getDay();
dayname = days[day];
month = timedate.getMonth();
monthname = months[month];
year = timedate.getFullYear();
if (length(minutes)==1) {
minutes = "0"+minutes;
}
if (length(seconds)==1) {
seconds = "0"+seconds;
}
currenttime = hour+":"+minutes+":"+seconds;
currentdate = todaydate+"/"+month+"/"+year;
fulldate = dayname+" "+todaydate+" "+monthname+" "+year;
delete timedate;
timedate = new Date();
}
我校对过好几次,但还是没有发现错误的地方特请画魔兄.Dawn兄指点,谢谢!!!