2/26/11

Make Time clock With Action Secript

Make Time clock With Action Script
Just Download This Fla File! And Check Complete Action Script  

And 
My solution:

//I also used only 2 frames in my movie clip.
//Used Johan Jansen's code for frame 2-- gotoAndPlay(_currentframe - 1);
//Changes to Code in 1st frame listed below:

date1 = new Date();

hoursIn1 = date1.getHours();
hoursIn1 = 1 + hoursIn1;

if (hoursIn1 == 25) {
hoursIn1= "01";

} else if (hoursIn1 < 10) {hoursIn1= "0" + hoursIn1;

} else {hoursIn1 = hoursIn1
}

//I used 'hours1' for the dynamic text's VAR property
hours1 = hoursIn1;
 
thanks for your tutorial, but the method you have used is too lengthy and it could be reduced a lot.For example the loop which you have used for adding an zero in front of Hours, minutes and seconds can be reduced by the following example.

if (time2 < 10)
{

time2="0"+time2;
}
if (time3 < 10)
{
time3 = "0"+time3;
}



No comments: