views:

15

answers:

0

I'm trying to change the text format in a TextField I get from a .swf. I'm embedding my font in a myFont.swf:

public class TemplateFont extends Sprite { [Embed(source='../fontFiles/geogrotesque/Geogrotesque-Regular.ttf', fontName='theFontName')] public static var FONT_TEXT:Class; }

Then I'm loading it where I need it and registering it:

var FontLibrary:Class = e.target.applicationDomain.getDefinition("TemplateFont") as Class; Font.registerFont(FontLibrary.FONT_TEXT);

And then I'm trying to set the format to my Textfield: txtTitle.embedFonts = true; txtTitle.antiAliasType = AntiAliasType.ADVANCED; var titleFormat:TextFormat = txtTitle.getTextFormat(); //TextFormat is set in swf, just wanna change font at runtime.

titleFormat.font = "theFontName; txtTitle.htmlText = title; //coming from xml sorrunded with CDATA txtTitle.defaultTextFormat = titleFormat; txtTitle.setTextFormat(titleFormat);

This all works fine when I'm running it on my computer, but as soon as I place my files on a server nothing shows. When I'm tracing the htmlText for the TextField it looks fine, but no text is showing up. I'm also tracing the registered fonts to see that they are there, and they are.

Anybody knows?