Flash tutorials
Home 3D (2) Actionscripting (65) Animation (100) Audio (4) Drawing (7) Full flash sites (4) Getting Started (15) Navigation (25) Special Effects (52) Text Effects (38)

Digital Clock

2.8.2006, 0:38    Total views: 23729
Time is money, and it is always helpful to know what time it is. Exactly this tutorial will teach you how to create a digital clock with date. For this tutorial I'll using flash8.



Step 1

Start by creating a 250x70px document in flash.



Step 2


Take the Text Tool (T), in the Properties Panel (Ctrl+F3) set the Static Text and somewhere on the stage type Time, and beneath Time, type Date. Look at the pictures below!







Step 3

After that take again the Text Tool (T), in the Properties Panel (Ctrl+F3) set Dynamic Text, and using drag and drop technique, draw two "rectangles" that will represent Time and Date. Look at the picture below and everything will be clear!



Step 4

Then select that two "rectangles" and press F8 on the keyboard to convert it into a Movie Clip. Look at the picture below!



Step 5

Double click on the new made Movie Clip ("rectangles"),or right click and choose Edit in Place.



Step 6

Select after that "rectangle" for Time, open the Properties Panel (Ctrl+F3), and under var: type time. Look at the picture below!





Step 7

Select "rectangle" for Date and in the Properties Panel (Ctrl+F3) under var: type date.



Step 8

Go back on the main scene (Scene1), select the "rectangles" (Movie Clip), open the Action Script Panel (F9) and paste this script:

onClipEvent (load) {
 days = new Array('Sunday','Monday','Tuesday','Wednesday','thursday','Friday',
'Saturday','Sunday');
 months = new Array('January','February','march','April','May',
'June','July','August','September','October','November','December');
 timedate = new Date();
}

onClipEvent (enterFrame) {
 hour = timedate.getHours();
 minutes = timedate.getMinutes();
 seconds = timedate.getSeconds();
 todaydate = timedate.getDate();
 day = timedate.getDay();
 dayname = days[day];
 month = timedate.getMonth();
 monthname = months[month];
 year = timedate.getFullYear();
 if (Length(minutes)==1) {
  minutes = "0" + minutes;
 }

 if (Length(seconds)==1) {
  seconds = "0" + seconds;
 }

 time = hour + ":" + minutes + ":" + seconds;
 date = dayname + " " + todaydate + " " + monthname + " " + year;
    delete timedate;
 timedate = new Date();
}


Test your Movie, we're done!

Download source file (.fla)
Have questions about this tutorial?
Visit our friendly Community Forums!
Digg it! Add this tutorial to del.icio.us! Furl it! Add this tutorial to reddit! Spurl it! Add this tutorial to technorati!

Top tutorials

1. Advanced full flash site - Part 1
Total views: 221533

2. Water effect
Total views: 166039

3. Photo slide show
Total views: 153638

4. High-tech city animation
Total views: 151459

5. Special Picture Effect
Total views: 146246

Related links