i have a digital clock that i want to have different events happen at certain times of the morning, i managed to work it for 1:00am but i need it to work for example 1:30am start and finish at 5am not to sure how to go about it.
stop();
var date:Date = new Date()
var day:int = date.day;
var hours:int = date.hours;
var minutes:* = date.minutes;
var seconds:* = date.seconds;
var timer:Timer = new Timer(1000);
if (hours > 24)
{
hours -= 12; ampm1.text = "PM"; }
else
{
ampm1.text = "AM";
}
clock1.text = hours + ":" + minutes + ":" + seconds;
function hideObjects(...targets)
{
for (var i:int = 0; i < targets.length; i++)
{
targets*.visible = false;
}}
function startClock(e:TimerEvent):void
{
date = new Date();
hours = date.hours;
minutes = date.minutes;
seconds = date.seconds;
if (hours > 11)
{
ampm1.text = "PM";
}
else
{
ampm1.text = "AM";
}
if (hours > 12)
{
hours -= 12;
}
if (String(minutes).length < 2)
{
minutes = "0" + minutes;
}
if (String(seconds).length < 2)
{
seconds = "0" + seconds;
}
clock1.text = hours + ":" + minutes + ":" + seconds;
}
timer.addEventListener(TimerEvent.TIMER, startClock);timer.start();
lock1.visible = false;
if (hours > 01){
unlock1.visible = false;
lock1.visible = true;}
if (hours < 05){
unlock1.visible = false;
lock1.visible = true;
}else {
lock1.visible = false;
unlock1.visible = true;}
if (hours < 01){
unlock1.visible = true;
lock1.visible = false;
}
var MiniLockout:lock = new lock;
var stageY:Number = 350;
MiniLockout.y = stageY;
open_Timer.addEventListener(MouseEvent.CLICK, miniTimerOpen);
function miniTimerOpen (e:MouseEvent) :void
{
addChild(MiniLockout);
}