Im going out of my mind here, how the F*** do i embed font in as3 projects coded in Flash Builder 4? I have been working on this all day and i am on the verge of throwing Flash Builder out the window and just start working in the Flash IDE again.
Here is a quick new project i set up to demonstrate my issue:
package {
/**
* Test code for embedding fonts
* @author Brian Lund Lauridsen
* @date Jan 28, 2010
*/
import flash.display.Sprite;
import flash.text.TextField;
import flash.text.TextFormat;
public class main extends Sprite {
//Embed(source='Arial.ttf', fontWeight='Regular', fontName="Arial", mimeType="application/x-font-truetype")] //isn't working either.
//var myFont:Class;
[Embed(systemFont='Arial', fontWeight='Regular', fontName="Arial", mimeType="application/x-font")]
public static const Arial:Class;
// Constructor
[SWF(backgroundColor=0xFFFFFF, width=800, height=600)]
public function main() {
var tf:TextFormat = new TextFormat("Arial", 100);
var t:TextField = new TextField();
t.setTextFormat(tf);
t.embedFonts = true;
t.text = "Some random text in Gotham";
t.width = t.height = 2000;
addChild(t);
}
}
}
No matter what i do, the text just comes up blank! God ■■■■ i am going nuts here. If i remove t.embedfonts = true i can see the text but only with the normal font.
Oh, and i am passing this on to the compiler arguments -managers flash.fonts.AFEFontManager