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

HOW CAN I MAKE THIS A WORKING CLOCK

Community Beginner ,
May 23, 2019 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();
     }

Views

266

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
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;

}

Votes

Translate

Translate
Community Expert ,
May 23, 2019 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?

Votes

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
community guidelines
Community Beginner ,
May 23, 2019 May 23, 2019

Copy link to clipboard

Copied

yes I do

Votes

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
community guidelines
Community Expert ,
May 23, 2019 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;

}

Votes

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
community guidelines
Community Beginner ,
May 23, 2019 May 23, 2019

Copy link to clipboard

Copied

will that work with the tweens in above code?

Votes

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
community guidelines
Community Expert ,
May 23, 2019 May 23, 2019

Copy link to clipboard

Copied

LATEST

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

Votes

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
community guidelines