View Full Version : Analog Clock in Flash


Backlight
01-23-2006, 05:43 PM
Ok heres how to make an Analog Clock in Flash

1. Open Flash and Create a new document..(size, fps, color doesn't really matter it's all up to you :))

2. In the first frame of your _root. or MAIN paste this code into the actions panel.


time = new Date();
seconds = time.getSeconds();
minutes = time.getMinutes();
hours = time.getHours();
hours = hours + minutes / 60;
seconds = seconds * 6;
minutes = minutes * 6;
hours = hours * 30;
sec._rotation = seconds;
min._rotation = minutes;
hour._rotation = hours;


3. Now create three more layers..
3a. On the first layer create the hand for seconds
3b. Above that create the hand for mins
3c. Above that create the hand for hours

4. Make sure that the bottom of the lines are centered and facing 12:00

5. Now convert each of them into Movie clips

6. Give each one an instence name according to it's job
(ie.. For hours give the name of "hour" for mins "min" and for secs "sec")

7. Now open each Movie clip and make sure that the registration point of each MC is at the VERY bottom of the line. (if this is not done the movie will not work properly) The registration point is the little plus looking thing when you double click on a movie clip, button or graphic and go into their timeline.
8. At this point you can test your movie and watch the hands working..

Extra: if you wanted too you could also draw graphics for your clock or numbers really what ever you want HAVE FUN!!!!!