In case Flash no longer exists; a copy of this site is included in the Flashpoint archive's "ultimate" collection.

Dead Code Preservation :: Archived AS3 works from wonderfl.net

Test for font

//////////////////////////////////////////////////////////////////////////////
Test for font
テキスト表示のためのテスト
//////////////////////////////////////////////////////////////////////////////
Get Adobe Flash player
by ProjectNya 12 May 2010
    Embed
/**
 * Copyright ProjectNya ( http://wonderfl.net/user/ProjectNya )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/t9nD
 */

////////////////////////////////////////////////////////////////////////////////
// Test for font
// テキスト表示のためのテスト
////////////////////////////////////////////////////////////////////////////////

package {

	import flash.display.Sprite;
	import flash.events.Event;
	import flash.text.TextField;
	import flash.text.TextFieldAutoSize;
	import flash.text.TextFieldType;
	import flash.text.TextFormat;
	import flash.text.TextFormatAlign;
	import net.wonderfl.utils.FontLoader;

	[SWF(backgroundColor="#FFFFFF", width="465", height="465", frameRate="30")]

	public class Main extends Sprite {
		private var loader:FontLoader;
		private var fontType:String = "IPAGP";
		private var txt:TextField;

		public function Main() {
			//Wonderfl.capture_delay(1);
			init();
		}

		private function init():void {
			loader = new FontLoader();
			loader.addEventListener(Event.COMPLETE, loaded, false, 0, true);
			loader.load(fontType);
			txt = new TextField();
			addChild(txt);
		}
		private function loaded(evt:Event):void {
			txt.x = 82;
			txt.y = 214;
			txt.width = 300;
			txt.height = 36;
			txt.autoSize = TextFieldAutoSize.CENTER;
			txt.type = TextFieldType.DYNAMIC;
			txt.selectable = false;
			txt.embedFonts = true;
			var tf:TextFormat = new TextFormat();
			tf.font = fontType;
			tf.size = 32;
			tf.align = TextFormatAlign.CENTER;
			txt.defaultTextFormat = tf;
			txt.text = "Test for font";
			//txt.appendText(String(txt.textHeight));
			txt.textColor = 0x000000;
		}

	}

}