A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: CS5 font embedding working like CS4 ?

  1. #1
    Member
    Join Date
    Oct 2010
    Posts
    36

    CS5 font embedding working like CS4 ?

    CS4 and CS5 font embedding is different and when creating TextFields dynamically you need to do the code differently in both cases in order to ensure that the font is properly accessed by ActionScript 3.0.

    Is there any reason why the way that it worked in CS4 still works in CS5 ?

    This happens for someone but in my case it is not working.

  2. #2
    Moderator enpstudios's Avatar
    Join Date
    Jun 2001
    Location
    Tampa, Fl.
    Posts
    11,282
    This is how I do it in AS3/CS5
    Just a note, you also need to create a new Font in the library for embedding to work.

    Actionscript Code:
    var a2iText:TextField = new TextField();
    var a2iTextFormat:TextFormat = new TextFormat();

    a2iText.embedFonts  = true;
    a2iTextFormat.font = "Verdana";
    a2iTextFormat.size = 30;
    a2iTextFormat.bold = true;
    a2iTextFormat.italic = false;
    a2iTextFormat.color = 0xFF0000;
    a2iTextFormat.align = "center";


    a2iText.defaultTextFormat = a2iTextFormat;
    a2iText.type = TextFieldType.DYNAMIC;
    a2iText.selectable = false;
    a2iText.autoSize = TextFieldAutoSize.CENTER;
    a2iText.x = 50;
    a2iText.y = 50;
    a2iText.antiAliasType = AntiAliasType.ADVANCED;
    a2iText.sharpness = -200;
    a2iText.text = "My Text";

    addChild(a2iText);

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center