Download the source: digitalclock
Step 1
- Create a new >Flash Project
- Click on the plus icon New flash file > “Flash file” > Change the name of project <Untitled File>.fla
- Select the Selection Tool V
- Go to Properties tab and press Edit button and set the width of your document to 300 pixels and the height to 100 pixels.
- Select #CCCCC color as background .
- Change the layer name to digital( double click on it ).
- Take the Text Toll (T) and draq 3 dynamic text, first for the hours (with instance name hours_t) second for the minutes ( with instance name minutes_t) and third for the seconds(with instance name seconds_t)
- Set the size of dynamic text to 50.0 pt, and any color.
- Add glow filter to the text:
Step 2
- Create a new layer and change the name to actionscript
- Copy / Paste the following code:
stage.addEventListener(Event.ENTER_FRAME,update date);
function updateDate(e:Event) :void {
var date = new Date ();
if (date.hours< 10) {
hours_t.text = "0" + date.hours;
}
else {
hours_t.text = date.hours;
}
if (date.minutes <10) {
minutes_t.text = "0" + date.minutes;
}
else {
minutes_t.text = date.minutes
}
if (date.seconds <10) {
seconds_t.text = "0" + date.seconds;
}
else {
seconds_t.text = date.seconds
}
}






February 13, 2011 at 10:42 pm
thansk a lot
June 27, 2011 at 12:04 pm
The code cannot be copied so here’s it …
stage.addEventListener(Event.ENTER_FRAME,update date);
function updateDate(e:Event) :void {
var date = new Date ();
if (date.hours< 10) {
hours_t.text = "0" + date.hours;
}
else {
hours_t.text = date.hours;
}
if (date.minutes <10) {
minutes_t.text = "0" + date.minutes;
}
else {
minutes_t.text = date.minutes
}
if (date.seconds <10) {
seconds_t.text = "0" + date.seconds;
}
else {
seconds_t.text = date.seconds
}
}