Evening All,
I have a movieclip on my stage, within this movieclip there are two frames, frame 1 shows a sun, frame 2 shows a moon. The way i determine which is shown at the moment is by using the getTime function. Quite nifty as it displays the sun in the day and the moon at the night. However i wish to demo this to my client (without sitting there at midnight to witness the change :().
So i want to be able to quickly show them what it does, just by clicking the moon, but this isn’t working, im guessing the getTime if statement is overriding my measly mouseClick authority…
Any ideas how i can achieve this thanks.
import flash.events.Event;
import flash.events.KeyboardEvent
import flash.ui.Keyboard;
import flash.events.MouseEvent;
addEventListener(Event.ENTER_FRAME, loop);
var clicked:Boolean = false;
function loop (e:Event){
this.rotation += 0.5;
doDate();
}
this.addEventListener(MouseEvent.CLICK, onClick);
function onClick (e:MouseEvent){
clicked = true;
trace("clicked");
trace(clicked);
}
function doDate()
{
var date:Date = new Date();
//trace (date);
if ((date.getHours() >=06) && (date.getHours() < 12) || clicked == true)
{
this.gotoAndStop(1);
}
if (date.getHours() >=12 && date.getHours() < 18)
{
}
if (date.getHours() >=18 && date.getHours()< 24)
{
}
if (date.getHours() >=01 && date.getHours() <06 && clicked == false)
{
this.gotoAndStop(2);
}
}