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

I Would Like Sum Help with A Timer

Community Beginner ,
May 08, 2019 May 08, 2019

I have on layer one the clock face

second layer is the clock hands as movie clip with instance name Hr , Min , Sec

third layer is start and stop button I used classic arcade button for this test  they are labeled startBtn and stopBtn

fourth layer is the code

import fl.transitions.Tween;
import fl.transitions.easing.*;
import fl.transitions.TweenEvent;
import flash.events.MouseEvent;

startBtn.addEventListener(Mouse.Event.CLICK,startTimer);
function startTimer(event: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);

stopBtn.addEventListener(MouseEvent.CLICK,stopTimer);
function stopTimer(event:MouseEvent){
  mytweensec.stop();
  mytweenmin.stop();
  mytweenhr.stop();
}


}

function onfinish(event:TweenEvent){
  event.target.start();
}

when I run it I get this error

Scene 1, Layer 'the script', Frame 1, Line 6 1119: Access of possibly undefined property Event through a reference with static type Class.

any suggestions

thanks

TOPICS
ActionScript
401
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 08, 2019 May 08, 2019

Mouse.Event.CLICK

should be

MouseEvent.CLICK

Translate
Community Expert ,
May 08, 2019 May 08, 2019

Mouse.Event.CLICK

should be

MouseEvent.CLICK

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 08, 2019 May 08, 2019

Ty lol I looked and looked and overlooked that .

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 08, 2019 May 08, 2019

would it be hard to make that timer 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
Community Expert ,
May 08, 2019 May 08, 2019
LATEST

use a TweenEvent.MOTION_CHANGE to update your display.

(p.s when using the adobe forums, please mark helpful/correct responses, if there are any.)

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