# Problem in digital clock

**URL:** <https://forum.kirupa.com/t/problem-in-digital-clock/210356>\
**Category:** Uncategorized\
**Created:** [December 18, 2006, 3:19am UTC](https://forum.kirupa.com/t/problem-in-digital-clock/210356 "2006-12-18T03:19:11Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![sabaruddon](https://avatars.discourse-cdn.com/v4/letter/s/e47774/32.png) [@sabaruddon](https://forum.kirupa.com/u/sabaruddon)\
**Post date:** [December 18, 2006, 3:19am UTC](https://forum.kirupa.com/t/problem-in-digital-clock/210356/1 "2006-12-18T03:19:11Z")

</div>

hi, i’ve got problem here… yesterday i’ve done a digital clock.its really cool.BUT, there’s a problem when i apply my digital clock in my flash website (fully in flash – not HTML, not PHP or etc.). when i click another page of the site, (only clocking when i open my flash site file) the clock was stop.why this happen and could someone help me to fix it up.

here my AS:

```auto

_root.onEnterFrame = function(){

var myDate:Date = new Date();
var myHours = myDate.getHours();
var myMinutes = myDate.getMinutes();
var mySeconds = myDate.getSeconds();
var AmPm;

if (myHours < 12){
    AmPm = "AM";
}
else
{
     AmPm = "PM";
}

if (myHours == 0) {
    myHours = 12;
}

if (myHours > 12) {
    myHours = myHours - 12;
}

if (myHours < 10) {
    myHours = "0" + myHours;
}

if (myMinutes < 10) {
    myMinutes = "0" + myMinutes;
}

if (mySeconds < 10) {
    mySeconds = "0" + mySeconds;
}

time_txt.text = myHours + ":" + myMinutes + ":" + mySeconds + " " + AmPm;

}

```
