var date Date new Date var hours Number var minutes Number function se

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
var date:Date = new Date();
var hours:Number;
var minutes:Number;
function setClock(arr_hour:MovieClip, arr_minute:MovieClip, date:Date) {
function getRotation(a:Number, b:Number) {
var rot:Number = a / b;
return rot * 360;
}
hours = date.hours + date.minutes / 60;
minutes = date.minutes + date.seconds / 60;
if (hours > 12) {
hours -= 12;
}
arr_hour.rotation = getRotation(hours, 12);
arr_minute.rotation = getRotation(minutes, 60);
}
setClock(hour_arrow, minute_arrow, date);
unix_time.text = (date.valueOf() / 1000).toFixed(0).toString();