View Single Post
Old 02-04-2008, 02:39   #1 (permalink)
thomasvining
Senior Member
 
thomasvining's Avatar
 
Join Date: Jul 2005
Location: Tokyo
Posts: 334
Send a message via MSN to thomasvining Send a message via Skype™ to thomasvining
Controlling time/numbers with flash

Hi there,

I'm currently building a flash clock screensaver, and so far have the clock showing the time correctly with the following code. What I would like to do now is start the movie 12 hours back from the current time, then fast forward (count up correctly in digits) during say the first 200 frames of the movie up to the current time.

Could anyone suggest an efficient way of doing this with as3?

Thanks very much in advance for any advice/suggestions!

-----------------------------------------------------------
FLASH CODE
-----------------------------------------------------------

function localTime(Event)
{
var dateate = new Date();

var hourZero:String = new String();
var minuteZero:String = new String();
var secondZero:String = new String();

var h:Number = date.getHours();
var m:Number = date.getMinutes();
var s:Number = date.getSeconds();

if (s < 10)
{
secondZero = "0";
}
else
{
secondZero = "";
}

if (m < 10)
{
minuteZero = "0";
}
else
{
minuteZero = "";
}

if (h < 10)
{
hourZero = "0";
}
else
{
hourZero = "";
}

var displayTime:String = (hourZero + h + ":" + minuteZero + m + ":" + secondZero + s);

textBox.text = displayTime;
textBox.embedFonts = true;
}

stage.addEventListener(Event.ENTER_FRAME, localTime);

-----------------------------------------------------------
__________________
  Reply With Quote