Flash

 Digital Clock
                                                            
this.onEnterFrame=function(){
   var  time:Date=new Date();
   var  h = time.getHours();
   var  m = time.getMinutes();
   var  s =time.getSeconds();
   
    var ampm;
    var clock:String= new String();
   
    if(h<10){h="0"+h;}
    if(m<10){m="0"+m;}
    if(s<10){s="0"+s;}
   
    if(h>12){ampm="PM"}
    else{ampm="AM"}
   
     if(h>12){h=h-12; }
   
clock=h+":"+m+":"+s+" "+ampm;
clock_dg.text=clock;
    }

//clock_dg is a textbox name
//create 2 layer and drow one layer to textbox and its name 'clock_dg' 
//other layer 1st keyframe to write about code