Internet Cross Logo
Internet Cross your one stop web tutorial website

Flash Clock

by Anand

Flash Clock

What is the time now?

Here is the electronic clock. It works on general maths formulas for rotation. As we know each needles of watch rotates 360° different variations in intervals. For.

Seconds:
takes 60 intervals to rotate 360°. Here
   intervals = 3600 / 60

Minutes:
takes 60 intervals to make 360°. Here
   intervals = 360 / 60

Hours:
takes 12 intervals to make 360°. Here
   intervals = 360 / 12

1. Create a movie clip and draw a line such that perpendicular to center for mc(movie clip) and give a name "sec". As shown in the image

2. Create two more clips for "min" and "hour" with varing size for particular needles.

3. Now create one more mc(time) and drag the three mc(sec, min, hour) such that their centers should coincide like a clock needles.

4. Give a intance name for particular clips (sec, min, hour) in separate layer.

5. Create new layer on the top & copy below code:

time=new Date(); // time object
seconds=(time.getSeconds())*6; // calculating seconds
minutes=(time.getMinutes())*6; // calculating minutes

hours=(time.getHours())*30; // calculating hours
sec._rotation=seconds; // giving rotation property
min._rotation=minutes;
hour._rotation=hours;

6. Note: this clock works on your system time.


[Download File][Page 1]
Visit our forums to discuss / post your problems.