I was trying to do this today and kept getting errors and then came across this:

http://forums.adobe.com/thread/441087

It goes on to say:

"Turns out the packages have been split up at least as early as build 7410 (May/2009) and I was including flex4.swc where the mx classes no longer reside."

I am not sure if it's the problem but I changed the classes I was using and that fixed it.

John

On 26/06/2010 17:38, Bill S. wrote:
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
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders




_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to