Highlighted

HOW CAN I MAKE THIS A WORKING CLOCK

Community Beginner ,
May 23, 2019

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();
     }

Adobe Community Professional
Correct answer by kglad | Adobe Community Professional

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;

}

TOPICS
Discussions

Views

102

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

HOW CAN I MAKE THIS A WORKING CLOCK

Community Beginner ,
May 23, 2019

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();
     }

Adobe Community Professional
Correct answer by kglad | Adobe Community Professional

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;

}

TOPICS
Discussions

Views

103

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
May 23, 2019 0
Adobe Community Professional ,
May 23, 2019

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?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
May 23, 2019 0
Community Beginner ,
May 23, 2019

Copy link to clipboard

Copied

yes I do

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
May 23, 2019 0
Adobe Community Professional ,
May 23, 2019

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;

}

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
May 23, 2019 0
Community Beginner ,
May 23, 2019

Copy link to clipboard

Copied

will that work with the tweens in above code?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
May 23, 2019 0
kglad LATEST
Adobe Community Professional ,
May 23, 2019

Copy link to clipboard

Copied

there's no need for tweens if you're displaying a clock.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
May 23, 2019 0