Go Back   The Clock Crew
Register FAQ Members List Search Today's Posts Mark Forums Read

Tutorials:flash:actionscript:regular_clock
Home   Backlinks   15 Views   Index   Random  
   

Regular Clock


By Roman Clock

–Compatable: MX, MX 2004, Flash 8–

1. First, create a movieclip and name it whatever you want. We will call it “clock”. Make 4 layers that are all 2 frames long.

2. Now create three (3) movieclips:

  • The second Hand on the 2nd layer, give it the instance name “secHand”
  • The minute Hand on the 4th layer, give it the instance name “minHand”
  • The hour Hand on the 3rd layer, give it the instance name “hourHand”

3. Now put this code in the action panel of the top layer:

mydate = new Date();
setProperty(secHand, _rotation, mydate.getSeconds()*6);
setProperty(minHand, _rotation, mydate.getMinutes()+(mydate.getSeconds()/60)*6);
setProperty(hourHand, _rotation, (mydate.getHours()*30)+(mydate.getMinutes()/2));

4. You are finished! Test it to make sure, if there are any problems notifiy me: kul_dg@yahoo.com. You can click HERE to go back.





  • Need more help? Post your questions HERE!!!
  • Thanks to Piney for a better minute hand code.

 

Powered by vBulletin® Version 3.6.3
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.