In this HD High Definition Flash tutorial after drawing a clock, from scratch, Avraham gives life, taking system date and time and through rotation method, makes it live!
This clock is now a web property performing revenue through ads.See the result!
I know it is fast, you can always stop the player, or mail questions…
Music: Pink Floyd Instrumental.
DOWNLOAD THIS TUTORIAL TO YOUR HARD DRIVE
DOWNLOAD THE SOURCE FLA FILE
CLICK HERE FOR A COMPLETE ACTIONSCRIPT 3.0 FLASH TIMER AND TIME CARTOON SMART TUTORIAL
HERE IS THE SOURCE CODE:
// by Avraham Saltoun.
// www.say-web.com
// FREE TO USE COPY and DISTRIBUTE!
// Let’s create the timer and the
// Date variable…
var myTimer:Timer = new Timer(1000);
var myDate:Date = new Date;
// Let’s create the time variables…
var mySeconds:int = new int;
var myMinutes:int = new int;
var myHours:int = new int;
myTimer.start();
myTimer.addEventListener(TimerEvent.TIMER, UpdateHands);
//The Function below will happen every second,
// indefinitely
function UpdateHands (e:TimerEvent):void //returns no value!
{
// In action script by default
// a new date has the current
// timestamp assigned
myDate = new Date;
// Hour Variables
mySeconds = myDate.getSeconds();
myMinutes = myDate.getMinutes();
myHours = myDate.getHours();
// Check if it is afternoon
if (myHours < 12 ) {myHours = myHours - 12;}
//The names have to be IDENTICAL
// to the instances created!!
SecondHand.rotation = (mySeconds * 6);
MinuteHand.rotation = (myMinutes * 6);
HourHand.rotation = (myHours * 30) + (myMinutes*0.5);
//The additional rotation in order to small
//advance to the next hours....
trace (myDate);
}




Mon, Aug 10, 2009
ActionScript