O'Reilly logo

The ActionScript 3.0 Quick Reference Guide by Rich Shupe, Darren Richardson, David Stiller, Jen deHaan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 15. How Do I Work with Text?

15.0 Introduction

This chapter will cover the basics of creating, formatting, and interacting with text fields and the text therein. Focusing on the mechanics of using text fields, rather than on string manipulations, this chapter will bring you up to speed with the essentials you need to add text to any project.

Flash uses three different kinds of text fields: static, dynamic, and input. The latter two types can be created and affected by ActionScript; they’re the focus of this chapter. Whenever you wish to exert ActionScript control over text, you turn to a dynamic text field. However, if you require user input, including anything from entering a user name and password to completing an essay, then you need to graduate to an input text field—essentially, dynamic fields with added user input features.

You’ll see in the first recipe of this chapter that you can very easily create a text field, and setting it to behave as a dynamic or input field is simply a matter of using a single property. This capability also means that you can switch between these two types, if the need arises.

The third text type, static, is accessible via ActionScript to a very limited degree, but only the Flash interface can create static text fields. You can retrieve text from a static text field, using the StaticText or TextSnapshot classes, but you must walk through the display list to find the desired field. Additionally, the Flash interface may break your text into multiple ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required