/** * Visit http://etcs.ru for documentation, updates and more free code. */ package { import flash.display.Sprite; import flash.display.*; import flash.events.Event; import flash.net.URLRequest; import flash.text.AntiAliasType; import flash.text.Font; import flash.text.FontStyle; import flash.text.TextField; import flash.text.TextFieldAutoSize; import flash.text.TextFormat; import ru.etcs.utils.FontLoader; //[SWF(width="650", height="500", frameRate="31", backgroundColor="#FFFFFF")] public class demo_h extends Sprite { private const _loader:FontLoader = new FontLoader(); private const _field:TextField = new TextField(); public function demo_h() { super(); stage.scaleMode = StageScaleMode.NO_SCALE; stage.align = StageAlign.TOP_LEFT; stage.showDefaultContextMenu = false; this._field.embedFonts = true; this._field.autoSize = TextFieldAutoSize.LEFT; this._field.antiAliasType = AntiAliasType.ADVANCED; //this._field.rotation = 45; this._field.x = 0; this._field.y = 0; this._field.width = stage.stageWidth; this._field.height = stage.stageHeight; this._field.border = true; super.addChild(this._field); this._loader.addEventListener(Event.COMPLETE, this.handler_complete); this._loader.load(new URLRequest('fonts.swf')); } private function handler_complete(event:Event):void { var fonts:Array = this._loader.fonts; for each (var font:Font in fonts) { var text:String = font.fontName; var tf:TextFormat = new TextFormat(font.fontName, 20); switch (font.fontStyle) { case FontStyle.BOLD: tf.bold = true; break; case FontStyle.BOLD_ITALIC: tf.bold = true; tf.italic = true; break; case FontStyle.ITALIC: tf.italic = true; break; } text=" ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; this._field.appendText(text+'\n'); this._field.setTextFormat(tf, this._field.length-text.length-1, this._field.length); } } } }