First time here? First time here? Newsletter Signup Newsletter
651326 Members and growing! | Flash Jobs
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: 5 Votes: 17
(10 being the highest)
» Author
Im me
» Download
Download the files used in this tutorial.
» Forums
More help? Search our boards for quick answers!

Comments

  • 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: S.Saipriya
» Title: Flash Fire Effect
» Description: This tutorial explains about how to create Fire Effect in Flash of Actionscript 2.0.I hope this tutorial helps you!
Featured Sound Loops
Image for equalize

Audio Player

» Author: Aidan Crouzet-Pascal
» Title: Falling Star
» Description: This loop is a cool sounding, E minor loop.
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: Brandan Paulin
» Description: Epic sounding loop with Brass, Percussion, Strings and Winds. This is actually part of a Loop Pack called the Coming where you can download the rest of the loops that go with it FREE from my website.