The number in front tends to change before it is ‘cover’.
I’m now stuck whether is it the animation problem which could have haven’t been the number not ‘cover’ before the time runs, or isit I have to do something else in the ActionScipt.
Its kinda hard to explain or visualize without looking at it and there’s animation involve. I’ve uploaded a fla files below.
http://www.mediafire.com/?nzmymjgtntz
Below is the AS3 code:
package{
import flash.display.MovieClip;
import flash.events.TimerEvent;
import flash.utils.Timer;
public class flipClock extends MovieClip {
private var clock:clockMC=new clockMC();
//seconds
private var secTop1=clock.second.top1.digit;
private var secTop2=clock.second.top2.digit;
private var secBot1=clock.second.bot1.digit;
private var secBot2=clock.second.bot2.digit;
private var seconds:Number;
private var minutes:Number;
private var hours:Number;
private var days:Number;
public function flipClock():void {
decrease();
addChild(clock);
}
private function decrease():void {
var countdownTimer:Timer=new Timer(1000);
//Adding an event listener to the timer object
countdownTimer.addEventListener(TimerEvent.TIMER,updateTime);
//Initializing timer object
countdownTimer.start();
}
private function updateTime(event:TimerEvent):void {
decreasTimerFunction();
updateSecond();
//updateMinute();
}
private function updateSecond():void {
var num1=seconds;
var num2=seconds+1;
if (num1<10) {
num1="0"+num1;
}
if (num2<10) {
num2="0"+num2;
}
if (num1==60) {
num1=0;
}
if (num2==60) {
num2=0;
}
secTop1.text=num1;
secTop2.text=num2;
secBot1.text=num1;
secBot2.text=num2;
clock.second.gotoAndPlay(1);
}
private function decreasTimerFunction():void {
//Create a date object for Christmas Morning
var endTime:Date=new Date(2010,4,26,0,0,0,0);
//Current date object
var now:Date=new Date();
// Set the difference between the two date and times in milliseconds
var timeDiff:Number=endTime.getTime()-now.getTime();
seconds=Math.floor(timeDiff/1000);
minutes=Math.floor(seconds/60);
hours=Math.floor(minutes/60);
days=Math.floor(hours/24);
// Set the remainder of the division vars above
hours%=24;
minutes%=60;
seconds%=60;
}
}
}