First time here? First time here? Newsletter Signup Newsletter
Login | Register | 651326 Members and growing!
Search tutorials
Author: Buzz
As far as I am aware this works in most versions of Flash, but I used Flash MX 2004 to create a dynamic text field and give it an instance name (eg. clock). Then just copy and paste the script below: stop(); _root.onEnterFrame = function() { //The current time is taken from the computers clock, and should technically work in all time zones myDate_date = new Date(); currentHour = myDate_date.getHours(); currentMinute = myDate_date.getMinutes(); //Makes sure the clock stay in 24hr format, for a 12hr clock simply change 24 to 12 if (currentHour>24) { currentHour = currentHour-24; } else if (currentHour == 0) { currentHour = 24; } //Whith out this part the hours before 10 will appear as 9 not 09!! if (currentHour<10) { currentHour = "0"+currentHour; } //Whith out this part the minutes before 10 will appear as 9 not 09!! if (currentMinute<10) { currentMinute = "0"+currentMinute; } //Arrays to create days and months, for other languages simply put in the translations daysofWeek_array = new Array(); daysofWeek_array[0] = "Sunday"; daysofWeek_array[1] = "Monday"; daysofWeek_array[2] = "Tuesday"; daysofWeek_array[3] = "Wednesday"; daysofWeek_array[4] = "Thursday"; daysofWeek_array[5] = "Friday"; daysofWeek_array[6] = "Saturday"; daysofMonth_array = new Array(); daysofMonth_array[0] = "January"; daysofMonth_array[1] = "February"; daysofMonth_array[2] = "March"; daysofMonth_array[3] = "April"; daysofMonth_array[4] = "May"; daysofMonth_array[5] = "June"; daysofMonth_array[6] = "July"; daysofMonth_array[7] = "August"; daysofMonth_array[8] = "September"; daysofMonth_array[9] = "October"; daysofMonth_array[10] = "November"; daysofMonth_array[11] = "December"; //The current date is taken from the computers clock myDate_date = new Date(); currentYear = myDate_date.getFullYear(); currentMonth = myDate_date.getMonth(); currentDate = myDate_date.getDate(); currentDay = myDate_date.getDay(); //this is how all the information is displayed in the dynamic tex field //if your text field is not called 'clock' change clock.text to 'instancename.text' clock.text = myDisplay_txt.text=""+daysofWeek_array[currentDay]+", "+daysofMonth_array[currentMonth]+" "+currentDate+", "+currentYear+" "+currentHour+":"+currentMinute+""; }; simple!!
» Level Intermediate

Added: 2004-12-08
Rating: 4.78 Votes: 18
(10 being the highest)
» Author
Im me
» Download
Download the files used in this tutorial.
» Forums
More help? Search our boards for quick answers!


  • There are no comments yet. Be the first to comment!

  • You must have javascript enabled in order to post comments.

Leave a Comment
  • Your email address will not be published. All fields are required.
Featured Flash FLA
» Author: work2survive
» Title: Girl Walking 1kb
» Description: Walking girl, animation just takes 1kb, using high heels shoes, and fashion model attitude.
Featured Sound Loops
Image for equalize

Audio Player

» Author: BoxCat
» Title: CPU Talk
» Description: From the cyberpunk RPG, "Nameless: the Hackers" Completely Free to use! Keywords: edm hip hop rap electronic mysterious mission hacking chase exciting spy ios ambient chilling love happy sad angry suspense
Latest Font
» Author: Fábio FAFERS
» Description: I created this font for free use. Everyone can apply it in personal or business texts. Its free, but I want to be communicated in case of business use. Donations are accepted to keep the project of free fonts alive! Thank you all
Featured Sound Fx
Image for equalize

Audio Player

» Author: nathan
» Description:

A recorded sound of the Dimensional Fork Gate.