Copy link to clipboard
Copied
import fl.transitions.Tween;
import fl.transitions.easing.*;
import fl.transitions.TweenEvent;
import flash.events.MouseEvent;
{
var mytweensec:Tween=new Tween(Sec,"rotation",None.easeNone,0,360,60,true);
var mytweenmin:Tween=new Tween(Min,"rotation",None.easeNone,0,360,60*60,true);
var mytweenhr:Tween=new Tween(Hr,"rotation",None.easeNone,0,360,60*60*12,true);
mytweensec.addEventListener(TweenEvent.MOTION_FINISH,onfinish);
mytweenmin.addEventListener(TweenEvent.MOTION_FINISH,onfinish);
mytweenhr.addEventListener(TweenEvent.MOTION_FINISH,onfinish);
}
function onfinish(event:TweenEvent){
event.target.start();
}
create 3 movieclips of the hour, minute and second hand. orient them all to point up or north. you can then use:
var d:Date;
this.addEventListener(Event.ENTER_FRAME,frameF);
function frameF(e:Event):void{
d=new Date();
hr.rotation = 30*(d.hours%12)+d.minutes/5;
min.rotation = 6*d.minutes;
sec.rotation = 6*d.seconds;
}
Copy link to clipboard
Copied
what do you mean by a 'working clock? do you want to display the current time based on the user's system clock?
Copy link to clipboard
Copied
yes I do
Copy link to clipboard
Copied
create 3 movieclips of the hour, minute and second hand. orient them all to point up or north. you can then use:
var d:Date;
this.addEventListener(Event.ENTER_FRAME,frameF);
function frameF(e:Event):void{
d=new Date();
hr.rotation = 30*(d.hours%12)+d.minutes/5;
min.rotation = 6*d.minutes;
sec.rotation = 6*d.seconds;
}
Copy link to clipboard
Copied
will that work with the tweens in above code?
Copy link to clipboard
Copied
there's no need for tweens if you're displaying a clock.