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
Mouse.Event.CLICK
should be
MouseEvent.CLICK
Copy link to clipboard
Copied
Mouse.Event.CLICK
should be
MouseEvent.CLICK
Copy link to clipboard
Copied
Ty lol I looked and looked and overlooked that .
Copy link to clipboard
Copied
would it be hard to make that timer a clock?
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.)
Find more inspiration, events, and resources on the new Adobe Community
Explore Now