Actionscript Analog Clock
| Category | : Flash | Views | : 18746 | ||
| Version | : 8 | Rating | : | ||
| Type | : Text | Source File | : actionscript-analog-clock.zip | ||
| Result | : See the result | ||||
Very simple design, but the clock is exactly synced with the system time.

The first thing to do is the hand Movie Clips, you need to make three of them: "HandHour", "HandMinute" and "HandSecond".

They need to be different in size, color and thickness. And the registration point should be located as in the image above.
Create another Movie Clip named "Clock", inside draw a clock without the hands; then start placing the hands: seconds, minutes, hours.
And give them the instance names: "sec", "min", "hours".
Select the hands Movie Clips, click on the Filters tab and add a "Drop Shadow" filter with these settings:

Now on the first frame of this Movie Clip paste:
this.onEnterFrame = function()
{
//new Date object; with day and time
var date = new Date();
//get hour with the date object
var hours = date.getHours();
//get minutes
var minutes = date.getMinutes();
//get seconds
var seconds = date.getSeconds();
//360 degrees divided by 60 minutes equal the degrees for each minute.
//Multiply the degrees by minute with our "minutes"
//variable to get the angle.
min._rotation = 360 / 60 * minutes;
//360 degrees divided by 12 hours times "hours" variable
hour._rotation = 360 / 12 * hours;
//360 degrees divided by 60 seconds times "seconds" variable
sec._rotation = 360 / 60 * seconds;
}
