Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

creating a CLOCK in Flash 5

Step-by-step tutorial

creating a CLOCK in Flash 5

by  davdesign  Posted    (Edited  )
[color green]Just to let you know that I'm relocating my server as of today, and for a period of three to four weeks, none of the links to my files on this site will work.

If you need a file from me which is linked from this site then please just email me details of the relevant link and I will send the relevant file(s) to you.

After I've relocated the server and all the files within it I shall endeavour to update all links in Tek-Tips.[/color]




Some of you may have had problems accessing these files, the links are now corrected, apologies. ;-)


Couldn't be easier, Flash does it all for you......

Create dynamic text-fields for each component you want to show (ie: hours, mins, secs, time, date, whatever) and give them each a variable name.

Right click the first frame of the timeline and insert actions thus:
[color red]
[color green]//This line sets up the 'object', necessary to associate the variables.[/color]
davdesigndate = new Date();
[color green]//This line associates the dynamic text-field containing the /:hours variable with the date object and requests the 'hours'. You can work the rest out from this.[/color]
/:hours = davdesigndate.gethours();
/:mins = davdesigndate.getMinutes();
/:secs = davdesigndate.getSeconds();
/:fulldate = new Date( year, month, date, hour, min, sec, ms );
[/color]

Right-click again on the first frame and select 'insert-frame' from the drop down menu, this ensures thst the 'seconds' are updated.

In the Actions pop-up within Flash you can find the Date functions under OBJECTS>DATE>.

An example resides at:

www.pinkzeppelin.com/FAQ/250-605/clockF5.html
www.pinkzeppelin.com/FAQ/250-605/clockF5.zip

To get the dots, just create a movie-clip with aplha tweening, for the flashing to represent one second, just insert frames between the tweens equivalent to the frame rate of the movie. ie: in the example, the distance between tweens is 20 becasue the movie fps is 20

dave

revision: 21-05-01 file links amended
revision: 05-10-01 file links amended
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top