flashcoders  

Re: [Flashcoders] AS3 - Embeding Fonts

EECOLOR
Thu, 15 May 2008 13:50:18 -0700

I am not sure what you are talking about, but using Flex Builder 3 and an
ActionScript project, this code works fine:

*package
{
 import flash.display.Sprite;
 import flash.text.TextField;
 import flash.text.TextFieldAutoSize;
 import flash.text.TextFormat;
 import fly.easing.Tween;
* *
 public class EmbedFontTest extends Sprite
 {
  [Embed(source="C:\\WINDOWS\\Fonts\\ARIAL.TTF", fontFamily="Arial")]
**  **private var _arial_str:String;
**  **private var _arial_fmt:TextFormat;
**  **private var _text_txt:TextField;
**
**  **public function EmbedFontTest()
**  **{
**  **  **super();
**  **  **this.initEmbedFontTest();
**  **}
**
**  **private function initEmbedFontTest():void
**  **{
**  **  **this._arial_fmt = new TextFormat();
**  **  **this._arial_fmt.font = "Arial";
**  **  **this._arial_fmt.size = 40;
**
**  **  **this._text_txt = new TextField();
**  **  **this._text_txt.embedFonts = true;
**  **  **this._text_txt.autoSize = TextFieldAutoSize.LEFT;
**  **  **this._text_txt.defaultTextFormat = this._arial_fmt;
**  **  **this._text_txt.text = "Test Arial Format";
**
**  **  **this.addChild(this._text_txt);
**  **}
 }
}*

Ahh, I re-read the the last question, hehe:

>is the only way to embed the font in the IDE??

Yes, you can not use AS3 to embed fonts if you are compiling using Flash
CS3. I am not sure what the problem is though. If you are compiling with
Flash CS3 anyway you have a way to embed them. If you insist on embedding
fonts using ActionsScript, you might consider downloading the Flex 3 SDK or
Flex Builder 3. The Flex SDK contains a compiler that can compile
ActionScript projects. You could use this compiler to compile your fonts
into separate swf and load those in.

>Flash doesn't understand any meta tags.

This is correct, Flash CS3 does not understand the metadata tags.

The ActionScript compiler from the Flex SDK does understand them, but not
all of them are usefull, most important, the [RemoteClass] and [Bindable]
tags can not be used in an ActionScript project.

The Flex compiler does understand them and also uses all of the Adobe
provided ones.


Greetz Erik





















On 5/15/08, SJM <[EMAIL PROTECTED]> wrote:
>
> Ive read a load of sites that reference that way of doing it, however id
> does not seam to work in AS3. Further down the page the guy who writes the
> blog it is says this...
>
>         Tink Says:
>         January 2nd, 2007 at 1:39 am
>         Flash doesn't understand any meta tags.
>         There is no need to use this method in Flash as you can embed the
> font in the IDE.
>         Granted it would be nice if Flash did understand the embed tag
> though.
>
>         Gianluca Says:
>         January 6th, 2007 at 11:21 pm
>         So how to embed font in Flash as3?
>
>         Tink Says:
>         January 7th, 2007 at 4:52 pm
>         Same as AS 2.0.
>         Either have the font in your library or create a TextField on the
> stage and embed the characters you want.
>
> Is this correct? is the only way to embed the font in the IDE??
>
>
> SJM
>
>   ----- Original Message -----
>   From: EECOLOR
>   To: Flash Coders List
>   Sent: Thursday, May 15, 2008 8:19 PM
>   Subject: Re: [Flashcoders] AS3 - Embeding Fonts
>
>
>   Second link on google: http://www.tink.ws/blog/embedding-fonts-in-as3/
>
>
>   Greetz Erik
>
>
>   On 5/15/08, SJM - Flash <[EMAIL PROTECTED]> wrote:
>   >
>   > Hi Guys
>   >
>   > i know about embeding fonts using the 'embed' button in the textfields
>   > property inspector within in the ide. Can anyone point me to some
> definitive
>   > solutions for embeding fonts into flash using actionscript (v3),!
>   >
>   > Thanks
>   >
>   > SJM
>
>   _______________________________________________
>   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
>
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders