# Counter works with analogue not digital?!

**URL:** https://forum.kirupa.com/t/counter-works-with-analogue-not-digital/151821
**Category:** Uncategorized
**Created:** [June 18, 2005, 10:06am UTC](https://forum.kirupa.com/t/counter-works-with-analogue-not-digital/151821 "2005-06-18T10:06:24Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![yossarian](https://avatars.discourse-cdn.com/v4/letter/y/9de0a6/32.png) [@yossarian](https://forum.kirupa.com/u/yossarian)
#### Post date: [June 18, 2005, 10:06am UTC](https://forum.kirupa.com/t/counter-works-with-analogue-not-digital/151821/1 "2005-06-18T10:06:24Z")

</div>

Any idea how I can make my analogue clock code work for a digital countdown timer?

users can input their own desired count down timer in minutes and sec, and when time’s up a sound is attached. That works fine with the analogue clock but I’m not sure how I can get my code to work with a digital one (btn components from Flash library). Any idea wat I need to do? Will post final fla when done so others can use it.

```auto
stop();
start_btn.onRelease = function (){
	alarmOn();
}
var startingTime:Number;
function alarmOn(){
	startingTime = getTimer();
	clock_mc.onEnterFrame = function() {
		var totalTimeToAlarm = (minutes.value * 60) + seconds.value;
		var secondsElapsed = Math.round((getTimer () - startingTime) / 1000);
		clock_mc.alarmHand_mc._rotation = totalTimeToAlarm / 10;
		clock_mc.secondHand_mc._rotation = secondsElapsed * 6;
		clock_mc.minuteHand_mc._rotation = secondsElapsed / 10;
		if (secondsElapsed >= totalTimeToAlarm) {
			activateAlarm();
		}
	}
}
var alarmSound:Sound = new Sound();
function activateAlarm() {
	delete clock_mc.onEnterFrame;
	clock_mc.secondHand_mc._rotation = 0;
	clock_mc.minuteHand_mc._rotation = 0;
	clock_mc.alarmHand_mc._rotation = 0;
	alarmSound.attachSound("sound1");
	alarmSound.start(0, loops.value);
	}

```

Cheers Yossi
