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?


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!";