This is my 1st tutorial about “Flash MX 2004”. Before begining this tutorial I think that you must have basic concepts and introduction about Flash MX.
It is very simple to build a digital clock. All you need to do is follow the steps given below.
STEPS TO FOLLOW
Insert 3 layers in your timeline window and name them, "background", "text" and "actions". Similar to the one shown below

- Select Frame1 of background layer, Design the framework for your digital clock.
- Select frame2 and press F5
- Now go to Frame1 of your text layer and insert Dynamic text field in your work area. Select frame2 and press F5To insert a Dynamic text field- Select text tool from your tool box,Select Dynamic text from Text pop-up menu in the Property inspector.Click on your work area wherever you want the digital clock to appear.
- Name this Dynamic text field instance as "clock_txt"
- Go to frame1 of actions layer. Copy and paste the below mentioned script in the action panel (red one)
time=new Date(); // time objectvar
seconds = time.getSeconds()
var minutes = time.getMinutes()
var hours = time.getHours()
if (hours<12)>
ampm = "AM";
}
else{
ampm = "PM";
}
while(hours >12){
hours = hours - 12;
}
if(hours<10)
{
hours = "0" + hours;
}
if(minutes<10)
{
minutes = "0" + minutes;
}
if(seconds<10)
{
seconds = "0" + seconds;
}
clock_txt.text = hours + ":" + minutes + ":" + seconds +" "+ ampm;
Now go to frame2 of actions layer and press F6 to insert a new keyframe.Still keeping the play head on the frame2, go to action panel and copy paste the below mentioned script. (red one)
gotoAndPlay(1);
Congratulations!! your digital clock is ready.Press Ctrl+Enter to view your clock.

No comments:
Post a Comment
Write your Comments here.