flash on 2015-2-21

by Cheshir
♥0 | Line 30 | Modified 2015-02-21 06:32:03 | MIT License
play

ActionScript3 source code

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

package {
    import flash.filters.GlowFilter;
    import flash.text.TextField;
    import flash.events.TimerEvent;
    import flash.utils.Timer;
    import flash.events.MouseEvent;
    import flash.display.Sprite;
    public class FlashTest extends Sprite {
        private var log:TextField = new TextField();
        public function FlashTest() {
            // write as3 code here..
            var second:Timer = new Timer(1000);
            second.start();
            second.addEventListener(TimerEvent.TIMER, tick);
            stage.addEventListener(MouseEvent.CLICK, click);
            addChild(log);
            this.filters = [new GlowFilter(0)];
        }
        
        public function tick(e:TimerEvent):void{
            count = 0;
            log.text = String(count);
        }
        
        private var count:int = 0;
        public function click(e:MouseEvent):void{
            count++;
            this.graphics.beginFill(0);
            this.graphics.drawCircle(e.localX, e.localY,2);
            log.text = String(count+' click per second');
        }

    }
}