• Home
  • Free Tutorials
  • Free Video Tutorials

Adobe Photoshop
Autodesk 3ds Max
CSS
Flash
Help Center Live
iPhone
Joomla
Make Money Online!
Mambo
mIRC
Outlook Express
SEO / SEM
Simple Machine Forum
Target Explorer

Actionscript Analog Clock

Category : Flash Views : 13891
Version : 8 Rating : 
3.2/5 (41 votes)
  • Currently 3.24/5
  • 1
  • 2
  • 3
  • 4
  • 5
Type : Text Source File: actionscript-analog-clock.zip
Result: See the result


Previous | 1 | 2 | Next

That's all; very simple, but accurate:
Free Flash Tutorials, Actionscript, Analog Clock

My clock on the left and the windows clock on the right.

Code Explanation

this.onEnterFrame = function() { var date = new Date();
A Date object has the current time and date of the computer its running.
We need to create one to get the time from it.

var hours = date.getHours();
The function getHours() returns the current hour.

var minutes = date.getMinutes();
getMinutes() returns the minutes.

var seconds = date.getSeconds();
And getSeconds() returns the seconds.

min._rotation = 360 / 60 * minutes;
To get the angle needed just divide the number of minutes that exists (60!) by 360º and multiply by the number of minutes we have now.

hour._rotation = 360 / 12 * hours; sec._rotation = 360 / 60 * seconds; }
The other two angles use the same logic.
Note that the hours uses the 12-hour notation instead of the 24-hour notation.


del.icio.us digg it Reddit Stumble Upon Technorati

Previous | 1 | 2 | Next
How to Video Tutorials on software by Helpvids.com

Video tutorial: Forex trading



Sponsors



Advertisement









Studio | Advertisement | About Webzo | Contact Webzo | Terms of Use | Free Video Tutorials by Helpivds

Copyright © 2007 NR Concepts Ltd. All rights reserved.