1. Home
  2. Computing & Technology
  3. Animation

Deconstructing the Paint Application VII: The Text Tool

By Adrien-Luc Sanders, About.com

3 of 5

Defining the Text Format Dynamically

In the onClipEvent (enterFrame) on this movie clip, we’ll need to create a new TextFormat function. TextFormat is a function that we haven’t covered yet that - you guessed it - lets us control the format of text. Similar to new Color () and setRGB, we first define a new TextFormat by name, then set the values of that text format before applying it to an existing text field using setTextFormat:
myTextFormat = new TextFormat();
myTextFormat.font="Verdana"
myTextFormat.size=_root.base.fontsizebox;
myTextFormat.bold=_root.base.fontbold;
myTextFormat.italic=_root.base.fontitalic;
_root.drawing.textname.setTextFormat(myTextFormat);

In this case the size, bold, and italic parameters are assigned to variables taken from the control panel, and update dynamically each time the frame loads. They’re then applied to a text field named textname.

Explore Animation
About.com Special Features

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

Easy ways to connect two computers for networking purposes. More >

  1. Home
  2. Computing & Technology
  3. Animation
  4. Flash Animation Tutorials
  5. Deconstructing the Paint Application VII: The Text Tool

©2009 About.com, a part of The New York Times Company.

All rights reserved.