Created
July 24, 2012 09:39
-
-
Save crazymaster/3169119 to your computer and use it in GitHub Desktop.
Numbers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package | |
| { | |
| import flash.display.*; | |
| import flash.events.*; | |
| import flash.text.*; | |
| import flash.geom.*; | |
| [SWF(backgroundColor="#000000", width="800", height="600", frameRate="30")] | |
| /** | |
| * ... | |
| * @author master ( https://github.com/crazymaster ) | |
| */ | |
| public class Main extends Sprite | |
| { | |
| private var tf:TextField = new TextField(); | |
| private var numbers:String="0"; | |
| private var current:int; | |
| private var timer1:int; | |
| public function Main():void | |
| { | |
| initialize(); | |
| addEventListener(Event.ENTER_FRAME, onEnterFrame); | |
| stage.addEventListener(Event.RESIZE,Resize); | |
| } | |
| //初期化 | |
| private function initialize():void | |
| { | |
| stage.scaleMode = StageScaleMode.NO_SCALE; | |
| stage.align = StageAlign.TOP_LEFT; | |
| tf.defaultTextFormat = new TextFormat("_sanrif", 28, 0x80FFFF, false); | |
| tf.width = stage.stageWidth; | |
| tf.autoSize = TextFieldAutoSize.LEFT; | |
| tf.wordWrap = true; | |
| tf.text = numbers; | |
| addChild(tf); | |
| } | |
| //リサイズ時に実行 | |
| private function Resize(ev:Event):void | |
| { | |
| stage.scaleMode = StageScaleMode.NO_SCALE; | |
| stage.align = StageAlign.TOP_LEFT; | |
| tf.width = stage.stageWidth; | |
| tf.autoSize = TextFieldAutoSize.LEFT; | |
| tf.wordWrap = true; | |
| addChild(tf); | |
| } | |
| // 毎フレーム行う処理 | |
| private function onEnterFrame(event:Event):void | |
| { | |
| draw(); | |
| } | |
| private function draw():void | |
| { | |
| if(timer1++>0){ | |
| if (tf.height >= stage.stageHeight && tf.width >= stage.stageWidth) { | |
| numbers=numbers.replace(/^\S?/,""); | |
| } | |
| tf.text = numbers; | |
| current++; | |
| numbers += current.toString(2); | |
| timer1 = 0; | |
| } | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment