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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

clock scripting

Status
Not open for further replies.
First you need to get the current time into Flash - look into the Date() object which will allow you to extract all of the relevant seconds, minutes, hours data etc.

Then you need to store each component of the time you retrieve as a variable and use those variables to trigger the video clips with gotoAndPlay statements along the lines of:

var frameToPlay='section'+minutes
gotoAndPlay(frameToPlay);

Not actually all that difficult from a code point of view but getting the video together and timed correctly will take a bit of work.
 
Well, here is an easier way than getting digital video.
If you have Flash MX, goto
C:/program files/Macromedia/flash mx/samples/fla/clock.fla

Here's the basic code:

Code:
_root.onEnterFrame = function() {
    // create an instance of the Date object
    myDate = new Date();
    // 
    // rotate clock Hands and shadows
    hourHand._rotation = myDate.getHours()*30+(myDate.getMinutes()/2);
                           [b]FLASH[i]freak :-P [/i][/b]
    
    minuteHand._rotation = myDate.getMinutes()*6+(myDate.getSeconds()/10);
    secondHand._rotation = myDate.getSeconds()*6;
    [code]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top