You are here : : Home > Free Resources > Flash Tutorials & Resources > Digital Clock |
Basics
Animation & Effects
Actionscript
Miscellaneous
Flash Articles
Free Flash Resources
Other Flash Resources
This tutorial will explain how to create a digital Clock in Flash
MX 2004. The download .fla file is also included at the end of the
tutorial.
Please note:
1. You need to have Flash
Player 7.0 installed to view the Flash animation.
2. Flash MX 2004 must be installed in your system to download the
.fla file.
It is very simple to build a digital clock. All you need to do is
follow the steps given below.
STEPS TO FOLLOW
![]() |
time=new Date(); // time object var seconds = time.getSeconds() var minutes = time.getMinutes() var hours = time.getHours() if (hours<12) { ampm = "AM"; } else{ ampm = "PM"; } while(hours >12){ hours = hours - 12; } if(hours<10) { hours = "0" + hours; } if(minutes<10) { minutes = "0" + minutes; } if(seconds<10) { seconds = "0" + seconds; } clock_txt.text = hours + ":" + minutes + ":" + seconds +" "+ ampm; |
gotoAndPlay(1); |
Congratulations!! your digital clock is ready.
Press Ctrl+Enter to view your clock.
No portion of these materials may be reproduced in any manner whatsoever, without the express written consent of Entheos. Any unauthorized use, sharing, reproduction or distribution of these materials by any means, electronic, mechanical, or otherwise is strictly prohibited.