Chapter 17 Example 15

by actionscriptbible
♥0 | Line 22 | Modified 2009-06-29 18:37:40 | MIT License
play

ActionScript3 source code

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

package {
  import flash.display.Sprite;
  import flash.text.*;
  import flash.utils.describeType;
  
  public class ch17ex15 extends Sprite {
    [Embed(systemFont="sansserif", fontName="mySans",
           mimeType="application/x-font", advancedAntiAliasing="true")]
    protected var fontClass:Class;
        
    public function ch17ex15() {
      var tf:TextField = new TextField();
      addChild(tf);
      tf.width = stage.stageWidth;
      tf.autoSize = TextFieldAutoSize.LEFT;
      tf.wordWrap = true;
      tf.antiAliasType = AntiAliasType.ADVANCED;
      tf.defaultTextFormat = new TextFormat("mySans", 12);
      tf.embedFonts = true;
      var fontInstance:* = new fontClass();
      tf.text = describeType(fontInstance);
    }
  }
}