Highlighted

I Would Like Sum Help with A Timer

Community Beginner ,
May 08, 2019

Copy link to clipboard

Copied

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

Adobe Community Professional
Correct answer by kglad | Adobe Community Professional

Mouse.Event.CLICK

should be

MouseEvent.CLICK

TOPICS
ActionScript

Views

194

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

I Would Like Sum Help with A Timer

Community Beginner ,
May 08, 2019

Copy link to clipboard

Copied

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

Adobe Community Professional
Correct answer by kglad | Adobe Community Professional

Mouse.Event.CLICK

should be

MouseEvent.CLICK

TOPICS
ActionScript

Views

195

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 08, 2019 0
Adobe Community Professional ,
May 08, 2019

Copy link to clipboard

Copied

Mouse.Event.CLICK

should be

MouseEvent.CLICK

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

Copy link to clipboard

Copied

Ty lol I looked and looked and overlooked that .

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

Copy link to clipboard

Copied

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

Copy link to clipboard

Copied

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.)

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