PLEASE note: These pages are here solely for historic purposes. New articles have not been written since 2001; many links in the index are broken; and most ahref.com email addresses will now bounce. Try visiting ep Productions, Incorporated, the web programming and development company behind this site.

Tip: Looking for industry conferences? Try the conference calendar.

web index ahref.com: a community space for web developers------ -----
IndexToolsCareersTalk
ahref.com > Guides > Design

Design Guide

Macromedia Flash Tutorial, Part II, Continued


Keeping Accurate Time

The Flash timer's basic timing element is 'Delay - 1 Second', a Movie Clip that loops about once per second. After each loop of the Delay Movie Clip (or after roughly each second), a Tell Target is used to implement the '1 Second' Movie Clip. When the digit in '1 Second' changes from 9 to 0 (or after about ten seconds), it will implement the '10 Seconds' Movie Clip. It will continue in this way, keeping time by bringing in ever larger movie clips.

This Flash timer is not very accurate, but it is totally contained in Flash and will work with every browser with Flash 3. A more accurate Timer can be made by using JavaScript and Flash Methods. Unfortunately, communication of FSCommands (commands sent from Flash) and Flash Methods (commands sent to Flash) require either Live Connect or ActiveX (32-bit only). This means that this method only works with Netscape 3 or later (on Windows 95/98/NT or Power Macintosh) or Internet Explorer 3 or later (on Windows 95/98/NT).

A more accurate timer can be made by using a JavaScript function, setTimeout('Settime()',1000), where setTimeout creates a delay of 1000 milliseconds (1 second), and Settime() is used to increment the timer. Though this is more accurate than the Movie Clip delay method, it is not perfectly accurate.

The Flash Clock (which keeps accurate time, instead of just recording elapsed seconds) also uses the setTimeout function, but only for updating the time (approximately 10 times a second). If the load on the computer delays the JavaScript execution, the correct time will be sent when JavaScript is again allowed to have processing time. The sample Flash Clock will display the user's local time based on the time set on the user's computer. A Flash Clock can also be built based using the time retrieved from the server.

continue reading >>>
or jump to a topic:

Introduction
Using Buttons to Get User Input
Controlling the Timer
Adding Actions to Buttons
Keeping Accurate Time
Finishing Up
Flash Resources


view a printable version of this article


To suggest a topic, please email guides@ahref.com.

 


HOME ||| ABOUT AHREF.COM ||| ADVERTISE ||| FEEDBACK ||| SEARCH THIS SITE ||| CONTRIBUTE

© 1998-1999 ep Productions, Inc. All rights reserved. Terms of use.