Copy link to clipboard
Copied
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
Hi,
I believe this line is the one causing problems:
tickerTxtField_format.font = embedFont.Font_Impact;
I guess it should be:
tickerTxtField_format.font = embedFont.fontName;
You actually want to use the property 'fontName' of the Font class, not substitute it for the name of your font.
Hope it helps,
Marcel
Copy link to clipboard
Copied
Hi,
I believe this line is the one causing problems:
tickerTxtField_format.font = embedFont.Font_Impact;
I guess it should be:
tickerTxtField_format.font = embedFont.fontName;
You actually want to use the property 'fontName' of the Font class, not substitute it for the name of your font.
Hope it helps,
Marcel
Copy link to clipboard
Copied
Hey shiftless, thanks for the reply!
Oh, ok... I thought it was weird to use the font name that "I" gave to it. So that makes sense.
I'll give that a try and post back with my results.
Thanks Again for the reply,
Matt
Copy link to clipboard
Copied
Hey shiftless, sorry for the late reply. I haven't been able to work on this much in the last week or so, but I was
able to get back to this today.
That change you posted was correct. Thanks for that, much appreciated!
Here's my working code:
*Embedded Font name is "Font_Impact"
var myFormat:TextFormat = new TextFormat();
var myFont:font;
:................................
:.......other code.......
:................................
:
myFont = new Font_Impact();
myFormat.font = Font_Impact.fontName;
:................................
:
Thanks Again,
Matt
Find more inspiration, events, and resources on the new Adobe Community
Explore Now