flash on 2010-4-13

by kihon
♥0 | Line 31 | Modified 2010-04-13 22:15:17 | MIT License
play

ActionScript3 source code

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

package
{
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.text.TextField;
	import flash.text.TextFormat;
	import com.bit101.components.PushButton;
 
	public class Main extends Sprite
	{
		private var bool:Boolean = true;
		private var tf:TextField;
 
		public function Main()
		{
			var button:PushButton = new PushButton(this, 365 / 2, 200, "change", buttonHandler);
 
			tf = new TextField();
			tf.defaultTextFormat = new TextFormat("_typeWriter", 60, 0x0, true);
			tf.text = bool.toString();
			tf.autoSize = "left";
			addChild(tf);
 
			tf.x = (465 - tf.width) / 2;
			tf.y = 100;
		}
 
		private function buttonHandler(event:Event):void
		{
			bool = !bool;
			tf.text = bool.toString();
 
			tf.x = (465 - tf.width) / 2;
			tf.y = 100;
		}
	}
}