I'm trying to understand why my embeded fonts wont work in AS3. I have extensive experience with this in AS2 but something has changed that's just not working.
I'm using the CS3 authoring tool to compile an .fla.
I included a font symbol in the library, set the linkage name to Fruitiger, checked export for AS and first frame and included the base class flash.text.Font.
Then in the class that needs it I imported flash.text.Font, flash.text.TextFormat, and flash.text.TextField.
The class is similar to this:
I get a red square on the stage but no text and no errors.PHP Code:package{
import flash.text.TextField;
import flash.text.TextFormat;
import flash.text.Font;
public class Demo extends Sprite{
var txtFormat:TextFormat;
public function Demo(){
txtFormat = new TextFormat();
txtFormat.font = "Fruitiger"
var tf:TextField = new TextField();
tf.background = true;
tf.backgroundColor = 0xFF0000;
tf.embedFonts = true;
tf.text = "Test Text";
tf.setTextFormat(txtFormat);
addChild(tf);
}
}
}
Any ideas on what I'm doing wrong?




Reply With Quote