-
AS3 countdown timer problem
Hi all, I need a timer that will hold 5 secs on say keyframe 20 then start again on keyframe 40 and keep repeating/restarting at additional keyframe intervals. The script below works only on frame 20. I would really appreciate any help with an example of how to get the timer function to work on multiple keyframes.
var fl_TimerInstance:Timer = new Timer(1000, 5);
fl_TimerInstance.addEventListener(TimerEvent.TIMER , fl_TimerHandler);
fl_TimerInstance.start();
var fl_SecondsElapsed:Number = 1;
function fl_TimerHandler(event:TimerEvent):void{
trace("Seconds elapsed: " + fl_SecondsElapsed);
fl_SecondsElapsed++;
if (fl_SecondsElapsed ==5) {
gotoAndStop(20);
}
}
-
Dignitary
for five seconds you put:
Code:
var fl_TimerInstance:Timer = new Timer(1000, 4);
because the second number is how many time it is repeated, not fired.
To restart a timer you can call the reset method:
Code:
fl_TimerInstance.reset()
-
Help with AS3 timer function
Many thanks for the kind help. Issue now resolved.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|