Client LoginView your Shopping CartHelp & Frequently Asked QuestionsEmail Us
Home Services Portfolio Rates & Deals Dreamweaver Templates Web Applications Free Tutorials About Us Contact Us
Web Design Guide > Best Web Design Tools | Web Design Ideas | Web Design Tips | Navigation Tips | Fireworks Tips | Rollover Images | Swap Images | CSS Styles Tutorial
Dreamweaver Tips | Dreamweaver Template | Server Side Includes | Dreamweaver Behaviors | Flash Tutorials > Flash Effects | Flash Sound Buttons | Sound On/Off Button
Flash Preloader | Importing External Data | Promotion > SEO Tips | Google Tips & Page Rank | JavaScript > Date Validation | Email Validation | Phone Validation | Tip Boxes

Showing Time in Flash

Flash Tutorial to Display Digital Time

In this Tutorial you will learn how to display time in Flash using Actionscript. You will learn about the Date object, how to write functions and call them using time delay in ActionScript. It is very simple and is neatly explained below.

Displaying Time in Flash using Actionscript

  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.

Absolutely FREE Web Templates
Check out these quality free web templates and download them without any registration or sign-up!

FREE Web Design Guide
From web design tips & ideas to HTML, CSS Styles, Fireworks & Dreamweaver you'll find all you need to know about effective web site design right here!

Quality Dreamweaver Templates
Professional quality dreamweaver templates in over 20 categories, starting at just $9.95! Instant download & easy customization

Services > Rapid 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 | Print & Logo Design Portfolio | Flash Animation Portfolio | Outsource Clients Portfolio | Client Testimonials
Rates & Deals > Web Design Rates | Custom Web Design Pricing | Logo Design Pricing | Business Card & Letterhead Pricing | Web Hosting Plans | Website Maintenance Plans