Skip to main content
Known Participant
May 8, 2019
Answered

I Would Like Sum Help with A Timer

  • May 8, 2019
  • 1 reply
  • 436 views

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

This topic has been closed for replies.
Correct answer kglad

Mouse.Event.CLICK

should be

MouseEvent.CLICK

1 reply

kglad
Community Expert
kgladCommunity ExpertCorrect answer
Community Expert
May 8, 2019

Mouse.Event.CLICK

should be

MouseEvent.CLICK

Known Participant
May 8, 2019

Ty lol I looked and looked and overlooked that .

Known Participant
May 8, 2019

would it be hard to make that timer a clock?