Client LoginView your Shopping CartHelp & Frequently Asked QuestionsEmail Us
Home Services Portfolio Web Design Pricing Dreamweaver Templates Web Applications Free Tutorials About Contact Us
Services > CSS Web Design | Professional Logo Design | ASP.net, ASP & PHP Programming | Flash Animation & Programming | Reliable Web Hosting | Website Maintenance
Portfolio > Web Design Portfolio | Web Programming Portfolio | Logo Design Portfolio | Web Design Pricing > Custom Web Design | Logo Design | Business Card Design
Web Design Guide > Website Design w/ Dreamweaver & Fireworks | Fireworks CS4 Cool Features | Photo Effects | Text Effects | Graphic Design Ideas | Web Design Ideas
Website Navigation Ideas | CSS Styles Tutorial | Dreamweaver Template | Server Side Includes | Flash Tutorials > Flash Effects | Flash Sound Button | Sound On/Off Button
Flash Preloader | Import External Data | Promotion > SEO Tips | Google Tips & Page Rank | JavaScript > Date Validation | Email Validation | Phone Validation | Tip Boxes

Flash Digital Clock

How to display digital time with Flash

In this tutorial you will learn how to display digital time using actionscript in Flash. You will learn about the date object, how to write functions and call them using time delay in actionscript.

Recommended Version: Adobe Flash CS4 Professional

Compatible Versions of Flash for this Tutorial

Flash MX 2004 & below | Flash 8 | Flash CS3 | Flash CS4
Note: For uses of lower versions of Flash some visual interface images would differ.
Recommended Version: Adobe Flash CS4 Professional
You Are Here ::: Home >> Free Tutorials >> Flash Tutorials >> Digital Clock

Follow the steps below:

Digital Time using Actionscript in Flash

  1. The Date class in Actionscript along with its various methods helps us to retrieve date and time values (Local / GMT).
  2. Create three Dynamic Textboxes for displaying the hours, minutes, seconds and name their variables as ch, cm, cs respectively.
  3. Write the following Actionscript code in the Actions window (F9) as given below:
  4. var dt, timeint;

    dt = new Date();
    ch = dt.getHours();    
    cm = dt.getMinutes();
    cs = dt.getSeconds();
    timeint=setInterval(timer,1000);

    function timer() {
    dt = new Date();
    ch = dt.getHours();
    cm = dt.getMinutes();
    cs = dt.getSeconds();
    }

  5. Variables dt, timeint Flash are first declared using the keyword 'var' and any function can be defined by using the keyword 'function' followed by a function-name and the function code which can be written within the {...} as shown above.
  6. The constructor new Date() is used create an instance of the Date object and assigned to the variable 'dt'.
  7. The methods getHours, getMinutes, getSeconds of the Date object are used to retrieve the hours, minutes, seconds and assigned to the 3 Dynamic Textbox variables.
  8. Save your work and test the Movie (Ctrl + Enter). That's it you have learnt how to create scrolling textboxes in Flash using Actionscript.

Note: GMT time can also be displayed in a similar manner by using the getUTCHours(), getUTCMinutes(), getUTCSeconds() methods of the Date object.

We would love to hear your comments and any suggestions on future tutorials we can add to this section. Thanks!

Fill the below form to submit your comments (or suggestions):
Bookmark and Share this web page.
Sponsored Link(s):
Beauty Templates | Business Templates | Christian Templates | CSS Templates | Education Templates | Family Templates | Flash Templates | Free Dreamweaver Templates
Food Templates | General Templates | Government Templates | Health/Medical Templates | Hi-Tech Templates | Kids/Childcare Templates | Low-cost Budget Templates
Personal Templates | Pets Templates | Photography Templates | Profession Templates | Real Estate Templates | Sports Templates | Telecom Templates | Travel Templates
Free Tutorials > Web Design Tutorials | CSS Web Design | Fireworks Tutorials | Dreamweaver Tutorials | Flash Tutorials | SEO Tutorials | Javascript Tutorials | PHP Tutorials