FireworksColdFusionDreamweaverFreehandFlashMXHome
Latest New Content

Latest Free Content
View All
Free Content
Accessibility
CMX Learning Guides
Hosted by enterhost

Working with Shared Libraries - Part 4: Sharing Fonts with Dynamic Text

By: Robert Reinhardt

Page 2 of 2

Set for printing

Previous

Using HTML Formatting with Dynamic Text Fields

If your runtime shared library file contains bold and/or italic options with exported font symbols, you can access these styles in HTML text assigned to dynamic text fields, without specifying the full font face name. For example, if you have imported bodyFont and bodyFont-Bold from the runtime shared library, you can simply use <b> tags in string values assigned to the htmlText property of a dynamic text instance. You learn how to do this task in the following steps.

  1. Resave the site_no_html.fla file as site_html.fla. You can should save this file in the same location as the shared_fonts.swf file.
  2. Select frame 1 of the actions layer, and open the Actions panel (F9, or Option+F9 on Mac). Modify the existing code to that shown in the following code. Here, you enable html text for the bodyField instance, and set its htmlText value to text that contains bold formatting. The last line of code should appear on one line in the Actions panel.

    var bodyField:TextField;
    var headingField:TextField;

    bodyField.html = true;
    bodyField.htmlText = "This is HTML text formatted with the bodyFont font, which is a shared font loaded from shared_fonts.swf. The file size of this movie is small--just " + this.getBytesTotal() + " bytes uncompressed--because the font characters are stored in the shared fonts SWF file. You can also access the <b>bodyFont-Bold</b> shared font by using the &lt;b&gt; tag.";

  3. Save the site_html.fla document, and test the movie. The bold formatting appears around the bodyFont-Bold name, as shown in Figure 2. If you want to include the bodyFont-Italic shared font to use <i> tags in the HTML text, add the font symbol to the site_html.fla file's library, as you learned in the last tutorial.


    Figure 2    HTML text displayed with the bodyField instance.

Conclusion

You now know how to use shared font symbols with dynamic text fields of other Flash movies. In the next tutorial of this series, you learn how to modify the font symbols of a runtime shared library to enable their use in dynamic text fields created at runtime.

Approximate download size: 166k

Page 2 of 2 Previous 1 2


download
Download Support Files


Keywords
runtime shared libray, dynamic text, shared font, font symbols