Blogadda

Blogadda
Visit BlogAdda.com to discover Indian blogs

Sunday, April 12, 2009

FONT EMBEDDING in AS3

FONT EMBEDDING in AS3

// ActionScript 3.0

[Embed(source="assets/ARIAL.TTF", fontFamily="ArialEmbedded")]

var ArialEmbedded:Class;

var arialEmbeddedFont:Font = new ArialEmbedded();


var textFormat:TextFormat = new TextFormat();

textFormat.color = 0xFF0000;
textFormat.font = arialEmbeddedFont.fontName;

textFormat.size = 32;

var textField:TextField = new TextField();

textField.autoSize = TextFieldAutoSize.LEFT;
textField.wordWrap = true;

textField.defaultTextFormat = textFormat;
textField.embedFonts = true;

textField.text = "The quick brown fox jumps over the lazy dog.";
textField.width = 500;

textField.x = 25;
textField.y = 25;


addChild
(textField);

No comments: