close
[flash教學] DIY自己做,電子數字時鐘語法...
一步、在場景上建立兩個動態文字(空文字)
輸入以下變數..
變數:day
變數:time
二步、建立一個圖層,命名action
action輸入:
now = new Date();
// 建構時間函數
year = now.getFullYear();
// 取得電腦中的年
month = now.getMonth()+1;
// 取得電腦中的月
day = now.getDate();
// 取得電腦中的日
day = year+"."+month+"."+day;
// 在變數為day的動態文字把三個取得的東西加起來顯示
hours = now.getHours();
// 取得電腦中的時
if(hours<10){
hours="0"+hours
}
//如果hours小於10,在小於10的數前面加一個0
minutes = now.getMinutes();
// 取得電腦中的分
if(minutes<10){
minutes="0"+minutes
}
seconds = now.getSeconds();
// 取得電腦中的秒
if(seconds<10){
seconds="0"+seconds
}
time = hours+":"+minutes+":"+seconds;
// 在變數為time的動態文字把三個取得的東西加起來顯示
好了,播放您製作結果~~

全站熱搜