EnterFrame

by _perfect
EnterFrameイベントでカウントする。

♥0 | Line 23 | Modified 2010-10-07 14:44:24 | MIT License
play

ActionScript3 source code

/**
 * Copyright _perfect ( http://wonderfl.net/user/_perfect )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/suK3
 */

package {
    import flash.display.Sprite;
    import flash.text.TextField;
    import flash.events.Event;
    import flash.utils.getTimer;
    
    public class FlashTest extends Sprite {
        private var draw_count:int;
        
        public function FlashTest() {
            // write as3 code here..
            draw_count = 0;
            
            var tf:TextField = new TextField();
            tf.background = true;
            tf.text = "Let's Start";
            tf.width = 300;
            tf.height = 2000;
            addChild(tf);
            
            this.addEventListener(Event.ENTER_FRAME ,doTimer);
            
            function doTimer():void{
                draw_count += 1;
                tf.text = String(draw_count);
            }
            
        }
    }
}