上方動態文字的變數為nowdate,下方動態文字的變數為nowtime
在文字時間影片片段元件上的ActionScript:
onClipEvent(load){
time=new Date();
}
onClipEvent(enterFrame){
hours=time.getHours();
minutes=time.getMinutes();
seconds=time.getSeconds();
todaydate=time.getDate();
month=(time.getMonth()+1);
year=time.getFullYear();
if(length(hours)==1){
hours="0"+hours;
}
if(length(minutes)==1){
minutes="0"+minutes;
}
if(length(seconds)==1){
seconds="0"+seconds;
}
if(length(todaydate)==1){
todaydate="0"+todaydate;
}
if(length(month)==1){
month="0"+month;
}
nowtime=hours+":"+minutes+":"+seconds;
nowdate=month+"/"+todaydate+"/"+year;
delete time;
time=new Date();
}
在指針時間影片片段元件上的ActionScript:
onClipEvent(load){
time=new Date();
}
onClipEvent(enterFrame){
hours=time.getHours();
minutes=time.getMinutes();
seconds=time.getSeconds();
todaydate=time.getDate();
month=(time.getMonth()+1);
year=time.getFullYear();
hours=hours*30+int(minutes/2);
minutes=minutes*6+int(seconds/10);
seconds=seconds*6;
delete time;
time=new Date();
}
在時針影片片段元件上的ActionScript:
onClipEvent (enterFrame)
{
setProperty(this, _rotation, _parent.hours);
}
在分針時間影片片段元件上的ActionScript:
onClipEvent (enterFrame)
{
setProperty(this, _rotation, _parent.minutes);
}
在秒針時間影片片段元件上的ActionScript:
onClipEvent
(enterFrame) {
setProperty(this, _rotation, _parent.seconds);
}