Here I’m going to tell you how to make Digital Clock in Flash, it will also be having the Date. It looks simple in Flash but we have to give some Conditions and make it according to our desire. Hopefully you will like it.

You can also visit Smooth Analog Clock to make Analog Clock in Flash.

[DOWNLOAD SOURCE FLA FROM HERE]

1. First of all Take a new file in Flash. Don’t worry about the size, just take according to your desire. I’m here taking 500×200 px with 12 FPS.

2. You can use any picture for background. I’ve prepared this kind of background:

Now if you want to show date and time in single line then you will need only 1 Dynamic text and if you want to show date and time in separate lines then you have to take different Dynamic Text. As I’m going to show date and time in 3 lines then I’m going to take 3 different Dynamic Text. Just pick Text tool and before writing anything goto Property Panel and select Dynamic instead of Static. Now click anywhere in the file. Don’t write anything in it, just change the size. Likewise put other two also.

3. Now select each text one by one and give it Variable Name. For this goto Property Panel and there will be OPTION portion, here you will find Variable box, write there any name:

I’ve given First text name as ‘dayname’, second text as ‘fulldate’ and third text as ‘fulltime’. Try to avoid giving reserved name like time, date etc. So that is why I’ve used word full alongwith date and time.

5. After putting all text and objects, just press F5 key once to take another Frame, because for changing time it need another frame so that it should have a small animation.

6. Now actual part is going to start here, we are now going to give ActionScript. I’m trying to use simple actionscript so that it will be helpful for new Flash users.

Click on First frame and Press F9 to show ActionScript panel, here write the following:

// Actionscript starts here:

// current date and time will be stored in stunning variable
stunning= new Date();
//this variable will be to get Day Name
a=stunning.getDay();
// this varialbe will be to get Date
b=stunning.getDate();
// this variable will be to get Month
c=stunning.getMonth();
// this varialbe will be to get Full Year i.e. 2010
d=stunning.getFullYear();
// this variable will be to get Hours
e=stunning.getHours();
// this variable will be to get Minutes
f=stunning.getMinutes();
// this variable will be to get Seconds.
g=stunning.getSeconds();

// if Date will be in single figure, then it will add 0 on its left
if (b<=9){
b=”0″+b;
}
// if we show contents of variable a (which is used for Day Name) it will show day number, like 0 for Sunday, 1 for Monday and so on, but we want to show Day Name here so we are going to give Day Name to variable.
if (a==0){
a=”Sunday”;
}
if (a==1){
a=”Monday”;
}
if (a==2){
a=”Tuesday”;
}
if (a==3){
a=”Wednesday”;
}
if (a==4){
a=”Thursday”;
}
if (a==5){
a=”Friday”;
}
if (a==6){
a=”Saturday”;
}
// likewise if we show contents of varaible c (in which we called Name of Month) then it will also show numbers like 0 for January, 1 for February and so on, so here we are putting Names of month in variable.
if (c==0){
c=”January”;
}
if (c==1){
c=”February”;
}
if (c==2){
c=”March”;
}
if (c==3){
c=”April”;
}
if (c==4){
c=”May”;
}
if (c==5){
c=”June”;
}
if (c==6){
c=”July”;
}
if (c==7){
c=”August”;
}
if (c==8){
c=”September”;
}
if (c==9){
c=”October”;
}
if (c==10){
c=”November”;
}
if (c==11){
c=”December”;
}
// If Hour is in single figure then it will add 0 on its left
if (e<=9){
e=”0″+e;
}
// If Minute is in single figure then it will add 0 on its left
if (f<=9){
f=”0″+f;
}
// If Second is in single figure then it will add 0 on its left
if (g<=9){
g=”0″+g;
}
// We are going to show these variables in Text boxes

dayname=a;
fulldate=c+” “+b+”, “+d;
fulltime=e+” : “+f+” : “+g;

//Actionscript Ends here

7. Here you will get Final Digital Clock and Date.

[DOWNLOAD SOURCE FLA FROM HERE]

You can also visit Smooth Analog Clock to make Analog Clock in Flash.