Macromedia Flash 8 Bible Free Open Book

Macromedia Flash 8 Bible

Previous Page
Next Page

Using Embedded Fonts with Components

In this section, you will explore how to use a custom font for a Button component. There are two ways to accomplish this: Use a dummy text field that embeds the font you want to use in the component, or add a Font symbol set to export from the Library panel. Both involve some ActionScript. First of all, let's look at the easier of the two methods.

  1. Open the component_style.fla document from the last section, and resave the document as component_embedded_font.fla.

  2. Select frame 1 of the actions layer, and delete the existing code. Add the following code:

    var cbt:mx.controls.Button;
    cbt.setStyle("fontFamily", "Futura");
    cbt.setStyle("embedFonts", true);
    

    This code sets the font face of the Button component to Futura. The second line tells the component that it should only display embedded fonts. If you tested your movie at this point, the label text for the component would be empty because the Futura font is not embedded in the movie.

  3. Create a new layer and name it tEmbedded. On frame 1 of this layer, select the Text tool and make a Dynamic text field off-stage. Give the field an instance name of tEmbedded in the Property inspector. In the font menu of the Property inspector, choose Futura. (If you don't have Futura, pick a different font name, and be sure to change the name in the code of Step 2.) Next, click the Embed button in the Property inspector. In the Character Embedding dialog box (shown in Figure 33-18), Ctrl+click (or z+click on the Mac) the Uppercase, Lowercase, and Numerals options. Click OK to accept these settings. You have now embedded the Futura font in the Flash movie.

  4. Save your Flash document, and test it. The Futura font (or your substituted font, if applicable) is the font used by the cbt instance.

Image from book
Figure 33-18: The Character Options dialog box
On the CD-ROM 

You can find the completed document, component_embedded_font.fla, in the ch33 folder of this book's CD-ROM.

If you don't want to use a dummy text field as this example illustrated, there is another way you can use an embedded font with a component. You can add a Font symbol to the Library panel, and set the font to export with the Flash movie. This method, however, will significantly add more weight (in bytes) to the movie's file size because all characters in the font are exported with the movie. We highly recommend you use an empty TextField instance with specific character ranges to minimize the size of your Flash movies.

Cross-Reference 

We show you how to embed specific styles of a font in Chapter 30, "Applying HTML and Text Field Formatting."


Previous Page
Next Page
Index: [A][B][C][D][E][F][G][H][I][J][K][L][M][N][O][P][Q][R][S][T][U][V][W][X][Y][Z]


     Main Menu
Table of Contents
Back Cover
Macromedia Flash 8 Bible
Foreword
Preface
Part I: An Introduction to Flash Web Production
Part II: Mastering the Flash Environment
Part III: Creating Animation and Effects
Part IV: Integrating Media Files with Flash
Part V: Adding Basic Interactivity to Flash Movies
Part VI: Distributing Flash Movies
Part VII: Approaching ActionScript
Part VIII: Applying ActionScript
Part IX: Integrating Components and Data-Binding
Chapter 33: Using Components
What are Components?
Why Use Components?
How to Add a Component
Where to Find Components, Assets, and Parameters
Modifying Component Color Properties and Parameters
Removing Components from Your Movie
Components in Flash 8
Understanding the Listener Event Model for Components
Using the Delegate Class to Control Scope with Listeners
Using Components in Your Movie
Modifying Components
Using Embedded Fonts with Components
Replacing Component Skins
Custom Components
Summary
Chapter 34: Binding Data and Events to Components
Chapter 35: Building an Image Gallery Component
Part X: Expanding Flash
Part XI: Appendixes
Index
List of Figures
List of Tables
List of Listings
List of Sidebars


More Books
PHP Hacks
Processing Xml With Java - A Guide To Sax, Dom, Jdom, Jaxp, And Trax
The Koran (Holy Qur'an)
Macromedia Flash 8 Bible
Search Engine Optimization for Dummies
YouTube Traffic
PHP 5 for Dummies
Harry Potter and The Chamber of Secrets
Harry Potter and the Sorcerer's Stone
The Pilgrim's Progress
Wireless Hacks
Flash Hacks. 100 Industrial-Strength Tips & Tools
PayPal Hacks. 100 Industrial-Strength Tips and Tools
Amazon Hacks
Pdf Hacks
The Da Vinci Code
Google Hacks
The Holy Bible
Windows XP For Dummies
Harry Potter and the Half-Blood Prince
Seo Book
Upgrading and Repairing Networks
Macromedia Dreamweaver 8 UNLEASHED
Windows XP Annoyances
Windows XP Hacks
Microsoft Windows XP Power Toolkit
Teach Yourself MS Office In 24Hours
iPod & iTunes Missing Manual
PC Hacks 100 Industrial-Strength Tips and Tools
PC Overclocking, Optimization, and Tuning - 2th Edition
PC Hardware In A Nutshell 3rd Edition
PC Hardware in a Nutshell, 2nd Edition
Upgrading and Repairing PCs
Google for Dummies
MySQL Cookbook
Teach Yourself Macromedia Flash 8 In 24 Hours
PHP CookBook
Sams Teach Yourself JavaScript in 24 Hours
PHP5 Manual
Free Games Paper Airplanes
500 Juegos Gratis 500 Giochi Gratis 500 Jeux Gratuits 500 Jogos Gratis 500 Kostenlose Spiele