主题:  画魔大闪!!帮我一下好吗???!!!

九头鸟

职务:普通成员
等级:1
金币:0.0
发贴:9
#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兄指点,谢谢!!!



网络白痴 | 5D荣誉斑竹

职务:普通成员
等级:4
金币:10.0
发贴:1657
#22001/5/29 8:54:02
hour = timedate.getHours()-1;
month = timedate.getMonth()+1;