1. Home
  2. Computing & Technology
  3. Animation

Deconstructing the Paint Application VII: The Text Tool

By Adrien-Luc Sanders, About.com

4 of 5

Changing the Text Field Type to Edit

Now that the formatting options are taken care of, all we need to do is determine when the text box is editable on click (using the onClipEvent (mouseDown) in this movie clip) and when it isn’t.

When any tool other than the text tool is active, the text field’s type should be dynamic, the text not selectable. Otherwise any time users try to paint or draw shapes, they’ll end up selecting text.

Only when the text tool is active should the text field’s type switch to input, so that the user can enter new text or edit existing text:

if(_root.textexists==true&&_root.isactive!="texttool"){
_root.drawing.textname.type="dynamic";
_root.drawing.textname.selectable=false;
}
if(_root.textexists==true&&_root.isactive=="texttool"&&_root.base.helptabs._visible==false){
_root.drawing.textname.type="input";
_root.drawing.textname.selectable=true;
}

The first statement checks to see if text exists and if the text tool is not active. If both are true, then the text field remains dynamic and its selectable property is false. The second statement checks to see if text exist and if the text tool is active. If both are true then the text field’s type becomes input and text is now selectable, so users can edit.

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.