Archive for VTW 
 



       VTW Forum Index -> Actionscript
computergeek67

Make a Digital Clock

Step 1: Create a Blank Flash Document
Start by creating a new Flash Document about 150x40 pixels, make sure you set it to ActionScript 2.0...  

Step 2: Create a Dynamic Text that stretches across the frame
Start by selecting the Text Tool and dragging it across the frame to make a text. Then under the properties panel, change it from Static text to Dynamic Text... After you have done this, set the Variable area (Var: ) to the variable Time



Step 3: Add the code to the frame
We are going to use the variables, sec, min, hour, and ampm during this process

Code:
// Create a new clock
 mydate = new Date();</p> <div class="codemain">
 // Set the variables to the correct times
 sec = mydate.getSeconds();
 min = mydate.getMinutes();
 hour = mydate.getHours();
 ampm = " AM";
 
 if(sec &lt; 10) sec = "0" + sec;
 if(min &lt; 10) min = "0" + min;
 if(hour &gt; 12){
 hour -= 12;
 ampm = " PM";
 }
 if(hour &lt; 10) hour = "0" + hour;
 
 Time = hour + ":"  + min + ":" + sec + ampm;


Step 4: Stretch the frame out so it runs continuously
Here we want to right click frame 2 and press insert frame



VIEW THE RESULT BELOW


-Project Finale Deigns


       VTW Forum Index -> Actionscript
Page 1 of 1
Create your own free forum | Buy a domain to use with your forum