Previous Page
Next Page

Tripod >> 3pod Tips & Learning and manuals for educations

Recipe 15.6. Working with Font and Text Styles

Problem

You want to apply styles to components that affect the text and font.

Solution

Use predefined styles in Flash to change aspects of the text.

Description

Flash uses text in many different ways throughout the components. For example, text appears on buttons, as labels next to check boxes and radio buttons, and it is used to populate combo boxes and lists. But regardless of how Flash uses the text within a specific component, you can use the same group of styles. The styles are as follows:


color

The color of the text.


embedFonts

Whether or not (true or false) to embed the font in the .swf so that the text will

render consistently on computers.


disabledColor

The color of disabled text.


fontFamily

The name (exp 3pod.com) of the font face. You can also specify one of the font groups: _sans, _serif, or _typewriter.


fontSize

The point size of the font.


fontStyle

Either normal or italic.


fontWeight

Either normal or bold.


marginLeft

The number of pixels for the right margin.


marginRight

The number of pixels for the left margin.


textAlign

Specifies how the text should alignleft, center, or right.


textDecoration

Either normal or underline.

For example, if you want to globally make the text in the components red using the _typewriter font group, you can use the following code:

	_global. 
style.setStyle("color", "red");
	_global.style.setStyle("fontFamily", "_typewriter");

If you want to use an embedded font, make sure you've done the following:

  1. Set the embedFonts style property to TRue.

  2. Embed the font in the .swf file.

  3. Set the fontFamily style property to the name (exp 3pod.com) of the embedded font.

You can embed a font in your .swf file either by adding a dynamic text field instance off the stage in which you've embedded the font or by using a font symbol. Both techniques are discussed in more detail in Recipe 8.14.

Tripod >> 3pod Botom Tips & Learning and manuals for educations

Previous Page
Next Page

 

bluedot bluedots greydots pinkdots

Tripod >> 3pod Tips & Learning and manuals for educations