# Embed font example for CS3

**URL:** <https://forum.kirupa.com/t/embed-font-example-for-cs3/290917>\
**Category:** flash\
**Created:** [June 22, 2009, 8:56am UTC](https://forum.kirupa.com/t/embed-font-example-for-cs3/290917 "2009-06-22T08:56:39Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![gag4n](https://avatars.discourse-cdn.com/v4/letter/g/df788c/32.png) [@gag4n](https://forum.kirupa.com/u/gag4n)\
**Post date:** [June 22, 2009, 8:56am UTC](https://forum.kirupa.com/t/embed-font-example-for-cs3/290917/1 "2009-06-22T08:56:39Z")

</div>

I’m trying to use the following script to embed a font in a CS3 flash file. When I publish and preview it, all I get is a blank screen :S Can someone tell me if this script is valid for AS3/CS3?

Thanks.

```
 [LEFT]

```

```auto
package {
    
//import flash.util.describeType;
import flash.display.MovieClip;
import flash.text.TextField;
import flash.text.TextFormat;
import flash.text.AntiAliasType;
import flash.text.TextFieldAutoSize;
import flash.text.TextFormatAlign;
  
   public class Test extends MovieClip {
    
      // be sure this is pointing to a ttf font in your hardrive
      [Embed(source="Arial.ttf", fontFamily="foo", mimeType="application/x-font-truetype")] 
      public var bar:String;
                  
      public function Test() {
                    
          var format:TextFormat = new TextFormat();
          format.font = "foo";
          format.color = 0xFFFFFF;
          format.size = 130;
                        
          var label:TextField = new TextField();
          label.embedFonts = true;
          label.autoSize = TextFieldAutoSize.LEFT;
          label.antiAliasType = AntiAliasType.ADVANCED;
          label.defaultTextFormat = format;
          label.text = "Hello World!";
          addChild(label);
          trace(label.text);
       }
    }
}

```

[/LEFT]
