Hi,
The analog clock is not that difficult of a project but a good understanding of Actionscript is required. If you do a google search for "flash analog clock" you will probably find a few demo's. If you want to contruct one from scratch, I can help with some pointers and AS tips....
Basics:
Understand how to manipulate movieclip timelines in onEnterFrame events.
Movieclip properties... namely.... rotation
Ability to use the Date object in Actionscript
Flash has the ability to use two different types of codeing...... object and frame. Object code is placed directly onto the object the code is written for. Frame code applies code to an object by instance name and is placed, as the name says, on a frame(usually the first frame of a movie). To make this easy to understand, I'll use an object code example....
Create a movieclip to serve as a holder. Inside this movieclip create three layers that will each hold a single movieclip. The three movieclips will be the hands of the clock...... hours,minutes,seconds. Give each movieclip an instance name.........hour,min,sec.......Go back to the main timeline, select the holder clip and paste this code in the actionscript panel with the holder clip highlighted.....
Code:
onClipEvent (load) {
timer = new Date();
}
onClipEvent (enterFrame) {
hours = timer.getHours();
minutes = timer.getMinutes();
seconds = timer.getSeconds();
if (hours>12) {
hours = hours-12;
}
if (hours<1) {
hours = 12;
}
hours = hours*30+int(minutes/2);
minutes = minutes*6;
seconds = seconds*6;
_root.holderInstanceName.hour._rotation=hours;
_root.holderInstanceName.min._rotation=minutes;
_root.holderInstanceName.sec. _rotation=seconds;
delete timer;
timer = new Date();
}
Regards
NTD
A mind once stretched by a new idea never regains its original dimensions.
- Oliver Wendell Holmes
Bookmarks