Flash CS4 Italic Text Formatting Issues(authoring vs runtime)

When dynamically creating a glossary tool tip on a flash page, the embedded italic text formatting of a TextField which was set in the authoring environment was not showing up at runtime in the flash player.

Apparently there is a bug in the flash player (http://craiggrummitt.blogspot.com/2008/06/kerning-of-dynamic-text-field.html) where the TextFormat information for a TextField is not retained when the text value was changed dynamically using Actionscript.

Our scenario:
We have a fla file that contains a pre-configured movie clip that has two textfields: a term name and a term definition. The term name was set to blue, italic text and the term definition was set to black, regular text. The regular font worked fine The italic font was not showing up. The pre-configured movie clip was placed offstage to be used when a glossary term was rolled over.

This is an image of the glossary preconfigured movie clip which is placed off stage in a flash file

We got it to work by doing the following:

  1. Desired Library italic font was created in the fla file and export for actionscript,frame 1 was selected.
  2. Italic TextField font was set to this new library font in properties tab
  3. Embedded characters in the properties tab for this TextField
  4. The GlossaryToolTip class was passed a reference to the TextField
  5. Constructor saved the initial TextFormat information for the TextField
  6. toolTipRollOver method resets the authortime format after text changes

1) Italic font created in library
Here is an image of the library font information:
Library Font Settings

2) Associating Library font to TextField
Here is an image of the TextField selection of the library font:
TextField PropertySettings

3) Embedding characters of selected Library in the TextField
Embedding characters in the selected TextField

5) GlossaryToolTip Constructor code
Code added to constructor(_fmt and _termText are private class variables):

_termText=termText;
//save the authortime text formatting
_fmt = _termText.getTextFormat();

6) GlossaryToolTip toolTipRollOver method additions
Code added to toolTipRollOver method:

// uses index to set the TextFields to the appropriate glossary text
_termText.text=_glossary.getTerm(index);
			
//10-21-09 fix, this resets the authortime format after text change
_termText.setTextFormat(_fmt);

Glossary tool tip in action
Glossary tool tip in action with italic text

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: