Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

HOW CAN I MAKE THIS A WORKING CLOCK

Community Beginner ,
May 23, 2019 May 23, 2019

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

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

correct answers 1 Correct answer

Community Expert , May 23, 2019 May 23, 2019

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;

}

Translate
Community Expert ,
May 23, 2019 May 23, 2019

what do you mean by a 'working clock?  do you want to display the current time based on the user's system clock?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
May 23, 2019 May 23, 2019

yes I do

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 23, 2019 May 23, 2019

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;

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
May 23, 2019 May 23, 2019

will that work with the tweens in above code?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 23, 2019 May 23, 2019
LATEST

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

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