IT Community - Software Programming, Web Development and Technical Support

Flash Analog Clock

This is a discussion on Flash Analog Clock within the Flash Actionscript Programming forums, part of the Web Development category; To Create a Flash Analog Clock: 1) Create a background for your clock, You can either draw it in fireworks ...


Go Back   IT Community - Software Programming, Web Development and Technical Support > Web Development > Flash Actionscript Programming

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 12-12-2007, 10:57 PM
aramesh aramesh is offline
D-Web Programmer
 
Join Date: Mar 2007
Posts: 72
aramesh is on a distinguished road
Default Flash Analog Clock

To Create a Flash Analog Clock:

1) Create a background for your clock, You can either draw it in fireworks or photoshop and import it onto your stage or draw it in flash itself.

2) Add 5 Layers in your Timeline window. Name them - interface, sec, min, hour and actions.

3) Import your clock background design into your interface Layer if you had created it else where.

4) Draw a line in your sec Layer. Select the line and press F8 to convert it to Symbol. Call this Symbol sec_mc, choose Movie clip behavior and select the bottom center square in registration. Press OK.

5) In your sec Layer, place sec_mc right at the center of your clock background design. Name it "sec" in instance text box of your property window. This is going to be your seconds needle.

6) Drag sec_mc into your min Layer from your library. If your library window is not open, press (Ctrl+L) to open it. Reduce sec_mc's height, may be by 3pix. Place it right at the center of your clock background design. Name it "min" in instance text box of your property window. This is going to be your minutes needle.

7) Drag sec_mc into your hour Layer from your library. Reduce its height, may be by 5 to 6pix. Place it right at the center of your clock background design. Name it "hour" in instance text box of your property window. This is going to be your Hours needle.
8) Copy and Paste the code given below in your actions window of actions Layer.

var time_interval:Number=0;

time_interval = setInterval(updateTime,1000);

function updateTime(){
time=new Date(); // time object
seconds = time.getSeconds()
minutes = time.getMinutes()
hours = time.getHours()
hours = hours + (minutes/60);
seconds = seconds*6;
// calculating seconds
minutes = minutes*6;
// calculating minutes
hours = hours*30;
// calculating hours
sec._rotation=seconds;
// giving rotation property
min._rotation=minutes;
// giving rotation property
hour._rotation=hours;
// giving rotation property
}

9) Now go to second frame of each layer and press F5 to insert new frame.


aramesh
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Clock on a webpage that syncs with the Atomic clock. itbarota HTML, CSS and Javascript Coding Techniques 1 03-16-2008 08:33 PM
Setup a clock with defined alarm times which trigger another event itbarota HTML, CSS and Javascript Coding Techniques 1 03-04-2008 09:57 PM
What is a computer's clock speed? itbarota Computer Hardware 4 01-07-2008 08:58 PM
How do I write a clock program in JavaScript? itbarota HTML, CSS and Javascript Coding Techniques 2 10-12-2007 10:55 PM
How to create a Analog style Scroll clock? bluesky HTML, CSS and Javascript Coding Techniques 1 07-22-2007 11:55 PM


All times are GMT -7. The time now is 07:11 PM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.

SEO by vBSEO 3.0.0