Try removing the underscore in your font name. In my experience, when embeding fonts, the name of the font in your code must match the font name exactly. cAse SeNsiTiVe.

I believe it should be.

"Arial"
Not
"_Arial"

And if your embedding arial.ttf, it should be "arial" as the font name.

Hth,
Karl

Sent from losPhone

On Jun 28, 2010, at 7:03 AM, "Bill S." <[email protected]> wrote:


Hi Christoffer, thank you for the answer; but adding fontFamily didn't help.

[Embed("arial.ttf", fontName="_Arial", fontFamily="_Arial", mimeType='application/x-font')]


John -- I tried messing with the flex swc but that didn't do it either -- although I have a feeling that it is related to this. I am digging further in.

Thanks
~Bill



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

One of the frustrating things with CS3 Flash was (contrary to many blogs -- and I believe the docs) that you could not actually [EMBED] fonts.

However this worked wonderfully in CS4.

But now, in (a fully updated) CS5 I can't seem to get EMBED to work again.


The below code is exactly the same in a CS4 and a CS5 FLA. Literally, the same fla file was copied and updated to CS5. The font class was untouched.

All it is meant to do is display "This is my text", which works in CS4.


The code is the same for both CS4 and CS5.
Am I missing something in the code? Or a setting?


import flash.text.AntiAliasType;
import flash.text.TextField;
import flash.text.TextFieldAutoSize;
import flash.text.TextFormat;

import fonts._Arial;

[SWF(backgroundColor="#ddffdd", frameRate="30")]


var Arial:_Arial = new _Arial();

try
 {
var _title:TextField = new TextField();
   with(_title)
{
   x = 1;
   y = 1;
   alpha = 100;
   background = false;
defaultTextFormat = new TextFormat (font="_Arial",size=24,color=0xff0000,align="center");
  width = 500;
  visible = true;
  selectable = true;
  type = TextFieldType.INPUT;
  antiAliasType = AntiAliasType.ADVANCED;
  embedFonts = true;
  text = "This is my text";
  trace("Embedded");  // Embedded is outputted in both cases.
}
stage.addChild(_title);

}
catch(e)
{
trace("error in TextField setup: " + e);
}


// the fonts._Arial class
package fonts
{
import flash.text.Font;
import flash.display.Sprite;

public class _Arial extends Sprite
{
[Embed("arial.ttf", fontName="_Arial", mimeType='application/x- font')]
 public var m_font:Class;

 public function _Arial():void
 {
  Font.registerFont(m_font);
 }
}
}


Thanks
~Bill
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to