In case Flash no longer exists; a copy of this site is included in the Flashpoint archive's "ultimate" collection.

Dead Code Preservation :: Archived AS3 works from wonderfl.net

Countdown from 600 Seconds

This script creates a dynamic textbox which counts down from 600 seconds, saying "Times Up!" when the counter equals zero.

It can be used as a game counter that operates a function upon time's end.
Get Adobe Flash player
by dmxn2k 16 Aug 2011
    Embed
/**
 * Copyright dmxn2k ( http://wonderfl.net/user/dmxn2k )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/w93y
 */

package {
    import flash.display.Sprite;
    public class FlashTest extends Sprite {
        public function FlashTest() {
            // write as3 code here..

// Author: senocular.com
// http://www.kirupa.com/developer/actionscript/setinterval2.htm

import flash.text.TextField;
import flash.utils.clearInterval;
import flash.utils.setInterval;


var displayTime:Number = 600; 
var timer:Number = 0;

var countDown:TextField = new TextField;
countDown.text = String(displayTime);
stage.addChild(countDown);
var countingDown = function(message){ 
displayTime--;
countDown.text = String(displayTime); 
if (displayTime == 0){ 
clearInterval(timer);
countDown.text = "Times Up!"; 
} 
} 
timer = setInterval(countingDown, 1000);
        }
    }
}