5 Replies Latest reply on May 5, 2009 5:13 PM by kglad

    Embedding fonts in dynamic text fields

    brian914 Level 1

      I am having trouble embedding a font in my Flash file. I have the font in my library. I have the text field selected to that font with the * next to it.

      In my actions I have:

      vid_title_txt.embedFonts = true;

       

      If I set it to false instead, it shows a different font. But if it is set to true, nothing shows. I am running out of ideas what to look at to solve this issue. What am I doing wrong here?

       

      Thank you very much for any help with this!

        • 1. Re: Embedding fonts in dynamic text fields
          kglad Adobe Community Professional & MVP

          you must create a textformat instance and assign its font property to the library font and then set the textfield's format to be your textformat instance.

           

          are you using as2 or as3?

          • 2. Re: Embedding fonts in dynamic text fields
            brian914 Level 1

            I am in AS2.

            I followed these steps.

             

            1. Open the Library panel (Ctrl+L).
            2. Add a font to your library - click the options menu in the upper right corner of the panel and select New Font from the menu.
            3. In the Font Symbol Properties dialog box select the font, size and style that you want and give the font combination a name. Click OK to close the dialog box.
            4. Right-click the font symbol in the library and select Linkage from the contextual menu.
            5. In the Linkage Properties dialog box, click the Export for ActionScript button to enable both the Identifier and AS 2.0 Class text input fields. Leave the default Identifier value and click OK to close the dialog box.
            6. Select the text tool from the Tools panel and draw a dynamic text field on the Stage.
            7. Give the text field an instance name of "my_txt". In the Font menu select the symbol name you gave the embedded font earlier. You should see a little asterisk (*) beside the name.
            8. In the Property inspector set the font size and style to match those in the Font Symbol Properties dialog box earlier.

            Open the Actions Panel and add the following code to Frame 1 of your Flash document:

            my_txt.embedFonts = true;
            my_txt._rotation = 15;
            my_txt._alpha = 10;
            • 3. Re: Embedding fonts in dynamic text fields
              kglad Adobe Community Professional & MVP

              var tfor:TextFormat=new TextFormat();

              tfor.font = "linkage id from library font";

              my_txt.setNewTextFormat(tfor);

              • 4. Re: Embedding fonts in dynamic text fields
                brian914 Level 1

                Awesome that worked!

                 

                Thank you!

                • 5. Re: Embedding fonts in dynamic text fields
                  kglad Adobe Community Professional & MVP

                  you're welcome.