How on Earth do you embed font in CS3 TextArea? Adobe documentation team WTF?

Author: seven September 29, 2007

While working on my last AS3 project, I wanted to cut my self some slack (spare some time), and instead of building TextField + scroller – use CS3 prebuilt TextArea component. Off course, not only that I didn’t achieve what I intended, I also spent 3 hours trying to figure that shit out.

I figured out that:

  • you STILL have to embed fonts if you masked TextArea (TextField too),
  • Online Flash CS3 Documentation is not what it should be.

Just, please take a look at the following link (Flash CS3 Documentation > Programming ActionScript 3.0 > Working with text > Advanced text rendering). There is absurd line that says: “The exact method of embedding a font file into your application’s SWF file varies according to your development environment.”. Well, HELLO? What is that page I am looking at then? Adobe’s help site is pretty awful (not as bad as ATI/AMD merged support sites – they are the worst), advanced searching is impossible and ordinary search gives you results that have no meaning. If you are looking for something on Adobe’s site related to Flash9 – my bet is you won’t find it.

Author
seven
CEO/CTO at Nivas®
Neven Jacmenović has been passionately involved with computers since late 80s, the age of Atari and Commodore Amiga. As one of internet industry pioneers in Croatia, since 90s, he has been involved in making of many award winning, innovative and successful online projects. He is an experienced full stack web developer, analyst and system engineer. In his spare time, Neven is transforming retro-futuristic passion into various golang, Adobe Flash and JavaScript/WebGL projects.

    7 thoughts on “How on Earth do you embed font in CS3 TextArea? Adobe documentation team WTF?”

  • Flash CS3 is very poorly finished. Not only the docs, but the UI is also slow and buggy. Hope they get their act together and release a patch like they did with MX 2004.

  • Yo C4RL05!!!! LOL! Yes, you still have to hack your way in/out of some situations. I really don’t know how Flex differs in internationalization areas, but I should definitely give it a spin.

    I think fellas at Adobe are too busy with plans on how to merge After Effects and Flash, instead of fixing things. Basic things like text rendering for example. :(

  • I got it to work.. First I had to extend the TextArea class. Details found at: http://www.gskinner.com/blog/archives/2008/03/adding_css_supp.html

    Then my code had:

    var theStyle:StyleSheet = new StyleSheet();
    var font:Font = new MyFont();

    theStyle.setStyle(“body”, {fontFamily:font.fontName, color:”#644724″, fontSize:12});
    theStyle.setStyle(“a”, {color:”#0000FF”});
    theStyle.setStyle(“a:hover”, {color:”#0000FF”, textDecoration:”underline”});

    desc_ta.setStyle(“embedFonts”, true);
    desc_ta.setStyle(“styleSheet”, theStyle); // instance

    StyleManager.setStyle(“styleSheet”, theStyle);

    And BOOM! CSS styled htmlText in a textArea component!

  • Hmmmm. Two points – 1) It appears to be AS2 compliant only. (In particular the line StyleManager.setStyle(”styleSheet”, theStyle);)

    2) If you apply a stylesheet style to a textarea it becomes noneditable, which is useless for many purposes (including mine!)

    So I am still seeking a solution as to how to apply a font color or size or type to a textarea

  • Thanks Neil!
    adding
    var myTextAreaTextField:TextField = textArea.textField;
    myTextAreaTextField.antiAliasType = AntiAliasType.ADVANCED;
    after
    var textArea:TextArea = new TextArea();
    solves the antialiasing issue too!
    Thanks again

  • Leave a Reply

    Your email address will not be published. Required fields are marked *