# AS 3 clock problem

**URL:** <https://forum.kirupa.com/t/as-3-clock-problem/323437>\
**Category:** flash\
**Created:** [June 30, 2011, 6:45pm UTC](https://forum.kirupa.com/t/as-3-clock-problem/323437 "2011-06-30T18:45:35Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![nnnswordfish](https://avatars.discourse-cdn.com/v4/letter/n/65b543/32.png) [@nnnswordfish](https://forum.kirupa.com/u/nnnswordfish)\
**Post date:** [June 30, 2011, 6:45pm UTC](https://forum.kirupa.com/t/as-3-clock-problem/323437/1 "2011-06-30T18:45:35Z")

</div>

Hy guys… i try to make digital clock in as 3 … but no luck it not working… i uploaded all source files here an please can u cheek please were is error? and why it doesn’t working? thanks

```auto
import flash.utils.Timer;
import flash.events.TimerEvent;

var time:Timer = new Timer(1000);
var date:Date = new Date();
var day:Number = date.day;
var hour:* = date.hours;
var minutes:* = date.minutes;
var seconds:* = date.seconds;

hideDaysAMPM(sun, tue, wed, thu, fri, sat, SunGlow, monGlow, tueGlow, wedGlow, thuGlow, friGlow, satGlow, am, pm, amGlow, pmGlow);
function hideDaysAMPM(...hideDAP)

{
   for (var i:int = 0; i<hideDAP.length; i++)
   {
      hideDAP*.visible = false;
   }
}

switch (day)

{
   case 0 :
   
   sun.visible = true;
   sunGlow.visible = true;
   break;
   
   case 1 :
   
   mon.visible = true;
   monGlow.visible = true;
   break;
   
   case 2 :
   
   tue.visible = true;
   tueGlow.visible = true;
   break;
   
   case 3 :
   
   wed.visible = true;
   wedGlow.visible = true;
   break;
   
   case 4 :
   
   thu.visible = true;
   thuGlow.visible = true;
   break;
   
   case 5 :
   
   fri.visible = true;
   friGlow.visible = true;
   break;
   
   case 6 :
   
   sat.visible = true;
   satGlow.visible = true;
   break;
   
}

time.addEventListener(TimerEvent.Timer, startTime);
time.start();

function startTime(e:TimerEvent):void{
   date = new Date();
   hour = date.hours;
   minutes = date.minutes;
   seconds = date.seconds;
   
   
   if(Number(hour)> 12){ {
      hour -= 12;
      pm.visible = true;
      pmGlow.visible = true;
      }
     
     else{
         am.visible = true;
         amGlow.visible = true;
      }
      if(String(hour).length < 2){
         hour = "0" + hour;
      }
       if(String(minutes).length < 2){
         minutes = "0" + minutes;
      }
       if(String(seconds).length < 2){
         seconds = "0" + seconds;
      }
      
      clockTxt.text = hour + ":" + minutes + ":" + seconds;
      clockTxtGlow.text = hour + ":" + minutes + ":" + seconds;
}

```
