求Flash高手帮帮忙,程序动作方面的问题

2024-12-26 16:30:01
推荐回答(1个)
回答1:

第一步:在第一真 插入如下代码:

newDate = new Date();
// Get the date, format it (mm.dd.yyyy) and send it to our text field
// Get hour and make sure the format is "00" and not "0"
Temp_Hour = newDate.getHours();
if (length(Temp_Hour)<2) {
Temp_Hour = "0"+Temp_Hour;
}
// Get minute and make sure the format is "00" and not "0"
Temp_Minute = newDate.getMinutes();
if (length(Temp_Minute)<2) {
Temp_Minute = "0"+Temp_Minute;
}
// Get second and make sure the format is "00" and not "0"
Temp_Second = newDate.getSeconds();
if (length(Temp_Second)<2) {
Temp_Second = "0"+Temp_Second;
}
// Format the time (hh:mm:ss) and send it to our text field
now = new Date();
dagen = new Array("一", "二", "三", "四", "五", "六","七","八","九","十");
for (i=0; i<=31; i++) {
sup[i] = "th";
if (i == 3 || i == 23) {
sup[i] = "rd";
}
// end if
if (i == 2 || i == 22) {
sup[i] = "nd";
}
// end if
if (i == 1 || i == 21 || i == 31) {
sup[i] = "st";
}
// end if
}
// end of for
day = dagen[now.getDay()];
TimeTextField = Temp_Hour+":"+Temp_Minute+":"+Temp_Second;
DateTextField = (newDate.getFullYear()+"年"+(newDate.getMonth()+1)+"月"+newDate.getDate()+"日");
alltime = (newDate.getFullYear()+"年"+(newDate.getMonth()+1)+"月"+newDate.getDate()+"日")+" "+day+" "+Temp_Hour+":"+Temp_Minute+":"+Temp_Second;

第二步:新建一层,在第一真处拉一个文本框 ,设置为动态文本,并设置变量为alltime。运行OK!