flash on 2010-5-23

by hacker_johiroshi
♥0 | Line 68 | Modified 2010-05-23 10:43:08 | MIT License
play

ActionScript3 source code

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

package {
  	import flash.display.Sprite;
   	import flash.text.TextField;
   	import flash.text.TextFormat;
	import flash.display.SimpleButton;
	import flash.events.MouseEvent;
	
	public class MessageBox extends Sprite {
        
	private var tf:TextField = new TextField();
	private var tfm:TextFormat = new TextFormat;
	private var button:SimpleButton = new SimpleButton();
	private var count:int = 0;
        
        	public function MessageBox() {


			//テキストのデフォルト値を設定
			//tf.defaultTextFormat = new TextFormat("", 20, 0x0, true);

			//TextFormatの生成
			tfm.color = 0x000000;
			tfm.size = 20;
			tfm.italic = true;
			tf.appendText("\nIntroduction2");
			tf.setTextFormat(tfm);
			addChild(tf);

			//Bottonの生成
			var up:Next = new Next(0x0);
			var over:Next = new Next(0xFF4500);
			var button:SimpleButton = new SimpleButton(up, over, over, over);
			button.x = 350;
			button.y = 350;
			button.addEventListener(MouseEvent.CLICK, onMouseClick);
			addChild(button);
			//removeChild(button);
			}

		//マウスプッシュに依る先送り。Message0.
		private function onMouseClick(event:MouseEvent):void
		{
			if(count==5)
			{
				startTetris();
				removeChild(button);		

			}

			var ms0:Array = ["学生も最後か。", "思えば短かったかもしれない。", "学生らしいのは高校生までか。", "これからは半社会人として生きていかなければならないと思うと気が重い。\n\nどうしよう。", "始まる…", "これは見えないはず", "確認"];

			tf.text = "\n僕:" + (ms0[count++]);
			tf.setTextFormat(tfm);
		}

		private function startTetris():void
		{	
			removeChild(tf);
			removeEventListener(MouseEvent.CLICK, onMouseClick);
			removeChild(button);		
		}
	}
}

import flash.display.Sprite;
import flash.text.TextField;
import flash.text.TextFormat;
 
class Next extends Sprite
{
	public function Next(color:int)
	{
		//”Next”枠の生成
		graphics.lineStyle(2.0, color);
		graphics.beginFill(0xFFFFFF);
		graphics.drawRect(0, 0, 100, 50);
		graphics.endFill();
 
		//"Next"のフォーマットの指定
		var tf1:TextField = new TextField();

		tf1.defaultTextFormat = new TextFormat("_typeWriter", 20, color, true);
		tf1.text = "Next";
		tf1.autoSize = "left";
        	tf1.width = 400;
        	tf1.height = 400;
		tf1.x =  (this.width  - tf1.width)  / 2;
		tf1.y = (this.height - tf1.height) / 2;
		tf1.selectable = false;
		addChild(tf1);
	}
}