Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 11-19-2009, 11:11 PM   #1
vnvlotus
Registered User
 
Join Date: Nov 2009
Posts: 4
Default [AS3] Countdown Clock for Game Over Screen

Hello. I am currently in a Flash game programming class and can't seem to find a clock anywhere that counts down and then does an action. I've been using Lynda tutorials and that hasn't been helpful and I have also Google searched quite a bit, but no luck. I have a Countdown clock and have been try "if" statements, but no luck.

Can someone guide me in the right direction on what I am doing wrong?

ActionScript Code:
// game timer var count:Number = 60; // amount of time var myTimer:Timer = new Timer(1000,count); // time in ms, count is calling from line above myTimer.addEventListener(TimerEvent.TIMER, countdown); myTimer.start(); function countdown(event:TimerEvent):void {     myText_txt.text = String((count)-myTimer.currentCount); //dynamic txt box shows current count } //if and else if statements if (((count)-myTimer.currentCount) == 58) {     gotoAndStop(2); }

Thank you!
~trevor
vnvlotus is offline   Reply With Quote
Old 11-19-2009, 11:44 PM   #2
embersyc
AS3/PHP Developer
 
Join Date: Feb 2008
Posts: 57
Default

Put your if statement inside your function.
embersyc is offline   Reply With Quote
Old 11-20-2009, 12:00 AM   #3
vnvlotus
Registered User
 
Join Date: Nov 2009
Posts: 4
Default

Woah! Thanks! I also found the TIMER_COMPLETE object thing. Both work great!

~trevor
vnvlotus is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 08:37 AM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.