flash on 2010-5-1
♥0 |
Line 37 |
Modified 2010-05-01 03:56:02 |
MIT License
archived:2017-03-30 10:08:34
ActionScript3 source code
/**
* Copyright 9re ( http://wonderfl.net/user/9re )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/uVxl
*/
package {
import flash.display.Sprite;
import net.hires.debug.Stats;
import flash.events.Event;
import flash.display.BitmapData;
import flash.events.MouseEvent;
import flash.utils.Timer;
import flash.events.TimerEvent;
import flash.text.TextField;
public class FlashTest extends Sprite {
private var _count:int = 0;
private var _tf:TextField;
public function FlashTest() {
// write as3 code here..
addChild(new Stats);
_tf = new TextField;
_tf.y = 100;
addChild(_tf);
var timer:Timer = new Timer(1000);
timer.addEventListener(TimerEvent.TIMER, timerHandler);
timer.start();
}
private function timerHandler(e:TimerEvent):void {
var bd:BitmapData = new BitmapData(800, 800);
var bd2:BitmapData = new BitmapData(10, 100);
_tf.text = ++_count + '';
_tf.width = _tf.textWidth + 4;
_tf.height = _tf.textHeight + 4;
stage.addEventListener(MouseEvent.CLICK, function ():void {
stage.removeEventListener(MouseEvent.CLICK, arguments.callee);
bd2.clone();
_tf.text = --_count + '';
_tf.width = _tf.textWidth + 4;
_tf.height = _tf.textHeight + 4;
});
}
}
}