Embeding Fonts in AS3?
Hello All,
Publish Settings:
Program: Flash Professional CS6
Target: Flash Player 11.2
Script: Actionscript 3
So I've created 2 new "Fonts" in my library in order to embed them into my Program. But when I run the program the font is not correct. Not sure
what I'm doing wrong..?
Below are the settings for the Embedded Fonts I included. There are 2 of them, which I created by right-clicking in the Library and clicking "New Font".
The First Font:
Name: "Font_Impact"
Char Ranges: All
Outline Format: TLF(DF4)
Linkage:
- Checked ---> Export for Actionscript
- Checked ---> Export in Frame 1 (*Don't know if I needed this but it was selected by default..??)
- Identifier ---> Greyed out....
- Class ---> "Font_Impact"
- Case Class ---> "flash.text.Font"
*NOTHING SELECTED HERE (*This was the default so I left it as is)
Sharing:
The seconds font has the exact same settings as the one above except:
Name: "Font_Arial_Black"
Class: "Font_Arial_Black"
Now, what I did was I followed the instructions I found here at this link below:
http://www.gaslightgames.co.uk/?p=163
I think I did exactly what they did in their example but it didn't seem to work for me.
My code where I'm trying to use this is:
import flash.text.TextField;
import flash.text.Font;
import flash.text.TextFieldAutoSize;
import flash.text.TextFormat;
import fl.text.TLFTextField;
var tickerTxtField:TLFTextField = new TLFTextField();
//var tickerTxtField:TextField = new TextField(); //---> Tried this one too, same result
var tickerTxtField_format:TextFormat; //TextFormatvar embedFont:Font_Arial_Black; //Embedded Font 1
var embedFont2:Font_Impact; //Embedded Font 2
:....
:............OTHER CODE............:
:............
embedFont = new Font_Arial_Black();
embedFont2 = new Font_Impact();
tickerTxtField_format = new TextFormat();
tickerTxtField_format.font = embedFont.Font_Impact;
tickerTxtField.text = "This is some sample Text To Display..."
:....
:............OTHER CODE............:
:............
I thought I was doing it correctly while I was following the instructions in the link I provided, but I can't seem to get it working.
Can anyone tell what I'm NOT doing correctly? Any thoughts would be greatly appreciated...!
Thanks in Advance,
Matt