2008年8月27日 星期三

第一次做Flash時鐘



打在圖層(數字部份時鐘)
_root.onEnterFrame = function(){
myDate = new Date();
h = myDate.getHours();
if (h<10){h="0"+h}
m = myDate.getMinutes();
if (m<10){m="0"+m}
s = myDate.getSeconds();
if (s<10){s="0"+s}

};

打在秒針(指針部份)
onClipEvent (enterFrame) {
myDate = new Date();
hou = myDate.getHours();
mina = myDate.getMinutes();
sec = myDate.getSeconds();
//說明mina乘6的由來是360度除60秒,所以得到的數值是6
//時針轉一圈一共有12時,所以360度除12得到的數值是30
_root.second._rotation = sec*6;
_root.mina._rotation = mina*6;
_root.hor._rotation = hou*30+mina/2;
}

沒有留言:

張貼留言