1. Computing & Technology

Discuss in my forum

Deconstructing the Paint Application VII: The Text Tool

By , About.com Guide

Setting Font Options on Load
Deconstructing the Paint Application VII: The Text Tool
Next we need to set a few basic parameters, inside the movie clip that we use as a controller for all objects in the drawing movie clip. We use the onClipEvent (load) handler that should already exist to define other values when the movie loads:
_root.textexists=false; 
_root.base.fontsizebox=15; 
_root.base.fontbold=false; 
_root.base.fontitalic=false;

First we set a variable determining if text has already been entered on the main canvas yet. The movie loads with no text, so the variable textexists=false. This helps determine the status of our text field, as we’ll be switching it from dynamic to input and back again so that text is not affected by painting motions when the text tool isn’t active.

The other variables represent user input from the control panel regarding font weight and size. This sets the default font size at 15, and makes sure that the variables representing bold and italic font weights are false.

©2012 About.com. All rights reserved.

A part of The New York Times Company.